repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Sloomey/DeepSpace2019 | src/autonomous/purepursuit.py | dda035c0ac100209b03a2ff04d86df09c6de9a85 | import math
from constants import Constants
from utils import vector2d
from wpilib import SmartDashboard as Dash
from autonomous import pursuitpoint
class PurePursuit():
"""An implementation of the Pure Pursuit path tracking algorithm."""
def __init__(self, path):
self.path = path
self.pursui... | [((546, 565), 'utils.vector2d.Vector2D', 'vector2d.Vector2D', ([], {}), '()\n', (563, 565), False, 'from utils import vector2d\n'), ((6145, 6186), 'utils.vector2d.Vector2D', 'vector2d.Vector2D', (['l_velocity', 'r_velocity'], {}), '(l_velocity, r_velocity)\n', (6162, 6186), False, 'from utils import vector2d\n'), ((681... |
TheEggi/esphomeyaml | esphome/voluptuous_schema.py | 98e8cc1edc7b29891e8100eb484922e5c2d4fc33 | import difflib
import itertools
import voluptuous as vol
from esphome.py_compat import string_types
class ExtraKeysInvalid(vol.Invalid):
def __init__(self, *arg, **kwargs):
self.candidates = kwargs.pop('candidates')
vol.Invalid.__init__(self, *arg, **kwargs)
def ensure_multiple_invalid(err):
... | [((394, 418), 'voluptuous.MultipleInvalid', 'vol.MultipleInvalid', (['err'], {}), '(err)\n', (413, 418), True, 'import voluptuous as vol\n'), ((240, 282), 'voluptuous.Invalid.__init__', 'vol.Invalid.__init__', (['self', '*arg'], {}), '(self, *arg, **kwargs)\n', (260, 282), True, 'import voluptuous as vol\n'), ((2212, 2... |
dpr1005/Semisupervised-learning-and-instance-selection-methods | semisupervised/DensityPeaks.py | 646d9e729c85322e859928e71a3241f2aec6d93d | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Filename: DensityPeaks.py
# @Author: Daniel Puente Ramírez
# @Time: 5/3/22 09:55
# @Version: 4.0
import math
from collections import defaultdict
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier, NearestNeighbor... | [((2879, 2924), 'scipy.spatial.distance.pdist', 'pdist', (['self.data'], {'metric': 'self.distance_metric'}), '(self.data, metric=self.distance_metric)\n', (2884, 2924), False, 'from scipy.spatial.distance import pdist, squareform\n'), ((2951, 2978), 'scipy.spatial.distance.squareform', 'squareform', (['distance_matrix... |
Bit64L/LeetCode-Python- | N-aryTreeLevelOrderTraversal429.py | 64847cbb1adcaca4561b949e8acc52e8e031a6cb | """
# Definition for a Node.
"""
class TreeNode(object):
def __init__(self, val, children):
self.val = val
self.children = children
class Solution(object):
def levelOrder(self, root):
"""
:type root: Node
:rtype: List[List[int]]
"""
if root is None:
... | [((388, 395), 'Queue.Queue', 'Queue', ([], {}), '()\n', (393, 395), False, 'from Queue import Queue\n')] |
akuala/REPO.KUALA | plugin.video.team.milhanos/websocket/_core.py | ea9a157025530d2ce8fa0d88431c46c5352e89d4 | """
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, ... | [((11409, 11418), 'six.b', 'six.b', (['""""""'], {}), "('')\n", (11414, 11418), False, 'import six\n'), ((11865, 11874), 'six.b', 'six.b', (['""""""'], {}), "('')\n", (11870, 11874), False, 'import six\n'), ((3191, 3207), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (3205, 3207), False, 'import threading\n'), ... |
Unanimad/lais_046_2020_etapa_2 | vaccine_card/logistic/models.py | 630efc6b25a580be44b6cd50be6744a01221a2c4 | from django.db import models
from vaccine_card.vaccination.models import Vaccine
class State(models.Model):
name = models.CharField(max_length=20, verbose_name='Nome')
class Meta:
verbose_name = 'Unidade Federativa'
def __str__(self):
return self.name
class City(models.Model):
nam... | [((122, 174), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'verbose_name': '"""Nome"""'}), "(max_length=20, verbose_name='Nome')\n", (138, 174), False, 'from django.db import models\n'), ((324, 376), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'verbose_... |
shenoyn/libcloud | test/test_rimuhosting.py | bd902992a658b6a99193d69323e051ffa7388253 | # 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.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not... | [((1226, 1254), 'libcloud.drivers.rimuhosting.RimuHostingNodeDriver', 'RimuHostingNodeDriver', (['"""foo"""'], {}), "('foo')\n", (1247, 1254), False, 'from libcloud.drivers.rimuhosting import RimuHostingNodeDriver\n')] |
lycantropos/gon | tests/base_tests/polygon_tests/test_contains.py | b3f811ece5989d1623b17d633a84071fbff6dd69 | from typing import Tuple
from hypothesis import given
from gon.base import (Point,
Polygon)
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.polygons)
def test_vertices(polygon: Polygon) -> None:
assert all(vertex in pol... | [((220, 246), 'hypothesis.given', 'given', (['strategies.polygons'], {}), '(strategies.polygons)\n', (225, 246), False, 'from hypothesis import given\n'), ((500, 538), 'hypothesis.given', 'given', (['strategies.polygons_with_points'], {}), '(strategies.polygons_with_points)\n', (505, 538), False, 'from hypothesis impor... |
HowcanoeWang/EasyIDP | easyidp/core/tests/test_class_reconsproject.py | 0d0a0df1287e3c15cda17e8e4cdcbe05f21f7272 | import os
import numpy as np
import pytest
import easyidp
from easyidp.core.objects import ReconsProject, Points
from easyidp.io import metashape
module_path = os.path.join(easyidp.__path__[0], "io/tests")
def test_init_reconsproject():
attempt1 = ReconsProject("agisoft")
assert attempt1.software == "metash... | [((162, 207), 'os.path.join', 'os.path.join', (['easyidp.__path__[0]', '"""io/tests"""'], {}), "(easyidp.__path__[0], 'io/tests')\n", (174, 207), False, 'import os\n'), ((256, 280), 'easyidp.core.objects.ReconsProject', 'ReconsProject', (['"""agisoft"""'], {}), "('agisoft')\n", (269, 280), False, 'from easyidp.core.obj... |
tiloc/python_withings_api | withings_api/const.py | 64c9706ab70c93e4c54cc843a778ecd3f9960980 | """Constant values."""
STATUS_SUCCESS = (0,)
STATUS_AUTH_FAILED = (100, 101, 102, 200, 401)
STATUS_INVALID_PARAMS = (
201,
202,
203,
204,
205,
206,
207,
208,
209,
210,
211,
212,
213,
216,
217,
218,
220,
221,
223,
225,
227,
228,
... | [] |
sirpercival/kivy | examples/canvas/bezier.py | 29ef854a200e6764aae60ea29324379c69d271a3 | #!/usr/bin/env python
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.slider import Slider
from kivy.graphics import Color, Bezier, Line
class BezierTest(FloatLayout):
def __init__(self, points=[], loop=False, *args, **kwargs):
super(BezierTest, self).__init__(*args, *... | [((921, 987), 'kivy.uix.slider.Slider', 'Slider', ([], {'y': '(0)', 'pos_hint': "{'x': 0.3}", 'size_hint': '(0.7, None)', 'height': '(50)'}), "(y=0, pos_hint={'x': 0.3}, size_hint=(0.7, None), height=50)\n", (927, 987), False, 'from kivy.uix.slider import Slider\n'), ((1077, 1144), 'kivy.uix.slider.Slider', 'Slider', (... |
reevespaul/firebird-qa | tests/bugs/core_6489_test.py | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | #coding:utf-8
#
# id: bugs.core_6489
# title: User without ALTER ANY ROLE privilege can use COMMENT ON ROLE
# decription:
# Test creates two users: one of them has no any rights, second is granted with 'alter any role' privilege.
# First user ('junior') must not hav... | [((1099, 1144), 'firebird.qa.db_factory', 'db_factory', ([], {'sql_dialect': '(3)', 'init': 'init_script_1'}), '(sql_dialect=3, init=init_script_1)\n', (1109, 1144), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((2048, 2110), 'firebird.qa.isql_act', 'isql_act', (['"""db_1"""', 'test_script_1'], {'s... |
MasoonZhang/FasterRConvMixer | utils/utils_bbox.py | a7a17d00f716a28a5b301088053e00840c222524 | import numpy as np
import torch
from torch.nn import functional as F
from torchvision.ops import nms
def loc2bbox(src_bbox, loc):
if src_bbox.size()[0] == 0:
return torch.zeros((0, 4), dtype=loc.dtype)
src_width = torch.unsqueeze(src_bbox[:, 2] - src_bbox[:, 0], -1)
src_height = torch.unsqueez... | [((235, 291), 'torch.unsqueeze', 'torch.unsqueeze', (['(src_bbox[:, (2)] - src_bbox[:, (0)])', '(-1)'], {}), '(src_bbox[:, (2)] - src_bbox[:, (0)], -1)\n', (250, 291), False, 'import torch\n'), ((306, 362), 'torch.unsqueeze', 'torch.unsqueeze', (['(src_bbox[:, (3)] - src_bbox[:, (1)])', '(-1)'], {}), '(src_bbox[:, (3)]... |
woozhijun/cat | lib/python/test/__init__.py | 3d523202c38e37b1a2244b26d4336ebbea5db001 | #!/usr/bin/env python
# encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8") | [((65, 96), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (87, 96), False, 'import sys\n')] |
odidev/pyclipper | tests/test_pyclipper.py | 3de54fa4c4d5b8efeede364fbe69336f935f88f2 | #!/usr/bin/python
"""
Tests for Pyclipper wrapper library.
"""
from __future__ import print_function
from unittest2 import TestCase, main
import sys
if sys.version_info < (3,):
integer_types = (int, long)
else:
integer_types = (int,)
import pyclipper
# Example polygons from http://www.angusj.com/delphi/clip... | [((15834, 15840), 'unittest2.main', 'main', ([], {}), '()\n', (15838, 15840), False, 'from unittest2 import TestCase, main\n'), ((1759, 1786), 'pyclipper.Area', 'pyclipper.Area', (['PATH_SUBJ_1'], {}), '(PATH_SUBJ_1)\n', (1773, 1786), False, 'import pyclipper\n'), ((1806, 1839), 'pyclipper.Area', 'pyclipper.Area', (['P... |
emre/espoem_facts | espoem_facts/facts.py | 0d7164dcfe8a82e1f142929b1e00c3a85f29f101 | FACTS = ['espoem multiplied by zero still equals espoem.',
'There is no theory of evolution. Just a list of creatures espoem has allowed to live.',
'espoem does not sleep. He waits.',
'Alexander Graham Bell had three missed calls from espoem when he invented the telephone.',
'espoem ... | [] |
hshayya/2022_Shayya_UPR_Guidance | imageproc_OE_IF_quant/2_annotate_extracted_cells.py | b9a305a147a105c3ac9c0173e06b94f66e4a6102 | import xml.etree.ElementTree as ET
import csv
import os
import re
from ij import IJ
from loci.plugins.in import ImporterOptions
from loci.plugins import BF
from ij.plugin import ImagesToStack
from ij import io
#Records metadata (x,y location) for cells that were extracted with 1_find_extract_cells.py
#metadata will be... | [] |
Abluceli/Multi-agent-Reinforcement-Learning-Algorithms | MAEnv/env_SingleCatchPigs/test_SingleCatchPigs.py | 15810a559e2f2cf9e5fcb158c083f9e9dd6012fc | from env_SingleCatchPigs import EnvSingleCatchPigs
import random
env = EnvSingleCatchPigs(7)
max_iter = 10000
env.set_agent_at([2, 2], 0)
env.set_pig_at([4, 4], 0)
for i in range(max_iter):
print("iter= ", i)
env.render()
action = random.randint(0, 4)
print('action is', action)
reward, done = env.s... | [((72, 93), 'env_SingleCatchPigs.EnvSingleCatchPigs', 'EnvSingleCatchPigs', (['(7)'], {}), '(7)\n', (90, 93), False, 'from env_SingleCatchPigs import EnvSingleCatchPigs\n'), ((244, 264), 'random.randint', 'random.randint', (['(0)', '(4)'], {}), '(0, 4)\n', (258, 264), False, 'import random\n')] |
rasmuse/eust | eust/tables/data.py | 2138076d52c0ffa20fba10e4e0319dd50c4e8a91 | # -*- coding: utf-8 -*-
import re
import gzip
import pandas as pd
import numpy as np
from eust.core import _download_file, conf
_DIMENSION_NAME_RE = re.compile(r"^[a-z_0-9]+$")
_YEAR_RE = re.compile(r"^(1|2)[0-9]{3}$")
def _is_valid_dimension_name(s: str) -> bool:
return bool(_DIMENSION_NAME_RE.match(s))
d... | [((154, 180), 're.compile', 're.compile', (['"""^[a-z_0-9]+$"""'], {}), "('^[a-z_0-9]+$')\n", (164, 180), False, 'import re\n'), ((193, 222), 're.compile', 're.compile', (['"""^(1|2)[0-9]{3}$"""'], {}), "('^(1|2)[0-9]{3}$')\n", (203, 222), False, 'import re\n'), ((886, 944), 'pandas.read_csv', 'pd.read_csv', (['path_or... |
fatemehtd/Echo-SyncNet | utils.py | ebb280e83a67b31436c4cfa420f9c06a92ac8c12 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from config import CONFIG
import json
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top
import io
import math
import os
import time
from absl i... | [((406, 427), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (420, 427), False, 'import matplotlib\n'), ((591, 632), 'tensorflow.unstack', 'tf.unstack', (['frames'], {'num': 'num_steps', 'axis': '(1)'}), '(frames, num=num_steps, axis=1)\n', (601, 632), True, 'import tensorflow as tf\n'), ((656, 6... |
dblack2056/UnityPy | UnityPy/classes/Sprite.py | 303291e46ddfbf266131237e59e6b1b5c46a9ca4 | from enum import IntEnum
from .Mesh import BoneWeights4, SubMesh, VertexData
from .NamedObject import NamedObject
from .PPtr import PPtr, save_ptr
from ..export import SpriteHelper
from ..enums import SpriteMeshType
from ..streams import EndianBinaryWriter
class Sprite(NamedObject):
@property
def image(self)... | [] |
albertfxwang/eazy-py | eazy/filters.py | bcfd8a1e49f077adc794202871345542ab29800b | import numpy as np
import os
from astropy.table import Table
from . import utils
__all__ = ["FilterDefinition", "FilterFile", "ParamFilter"]
VEGA_FILE = os.path.join(utils.path_to_eazy_data(),
'alpha_lyr_stis_008.fits')
VEGA = Table.read(VEGA_FILE)
for c in VEGA.col... | [((281, 302), 'astropy.table.Table.read', 'Table.read', (['VEGA_FILE'], {}), '(VEGA_FILE)\n', (291, 302), False, 'from astropy.table import Table\n'), ((3424, 3466), 'numpy.hstack', 'np.hstack', (["[self.wave, VEGA['WAVELENGTH']]"], {}), "([self.wave, VEGA['WAVELENGTH']])\n", (3433, 3466), True, 'import numpy as np\n')... |
KevinTMtz/CompetitiveProgramming | LeetCode/106.py | 0bf8a297c404073df707b6d7b06965b055ccd872 | #
# LeetCode
#
# Problem - 106
# URL - https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/
#
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = ri... | [] |
skvorekn/evalml | evalml/automl/automl_search.py | 2cbfa344ec3fdc0fb0f4a0f1093811135b9b97d8 | import copy
import time
from collections import defaultdict
import cloudpickle
import numpy as np
import pandas as pd
import woodwork as ww
from sklearn.model_selection import BaseCrossValidator
from .pipeline_search_plots import PipelineSearchPlots
from evalml.automl.automl_algorithm import IterativeAlgorithm
from ... | [((1498, 1518), 'evalml.utils.logger.get_logger', 'get_logger', (['__file__'], {}), '(__file__)\n', (1508, 1518), False, 'from evalml.utils.logger import get_logger, log_subtitle, log_title, time_elapsed, update_pipeline\n'), ((9426, 9473), 'evalml.objectives.get_objective', 'get_objective', (['objective'], {'return_in... |
deepsourcelabs/django-graphql-social-auth | graphql_social_auth/mutations.py | a0cc7715144dc289ccb4d2430e7c3b94fc1dffba | import graphene
from graphql_jwt.decorators import setup_jwt_cookie
from . import mixins, types
from .decorators import social_auth
class SocialAuthMutation(mixins.SocialAuthMixin, graphene.Mutation):
social = graphene.Field(types.SocialType)
class Meta:
abstract = True
class Arguments:
... | [((217, 249), 'graphene.Field', 'graphene.Field', (['types.SocialType'], {}), '(types.SocialType)\n', (231, 249), False, 'import graphene\n'), ((332, 362), 'graphene.String', 'graphene.String', ([], {'required': '(True)'}), '(required=True)\n', (347, 362), False, 'import graphene\n'), ((378, 408), 'graphene.String', 'g... |
Juan0001/yellowbrick-docs-zh | yellowbrick/regressor/base.py | 36275d9704fc2a946c5bec5f802106bb5281efd1 | # yellowbrick.regressor.base
# Base classes for regressor Visualizers.
#
# Author: Rebecca Bilbro <rbilbro@districtdatalabs.com>
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Fri Jun 03 10:30:36 2016 -0700
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.tx... | [] |
falkamelung/isce2 | contrib/stack/stripmapStack/crossmul.py | edea69d4b6216f4ac729eba78f12547807a2751a | #!/usr/bin/env python3
import os
import argparse
import logging
import isce
import isceobj
from components.stdproc.stdproc import crossmul
from iscesys.ImageUtil.ImageUtil import ImageUtil as IU
def createParser():
'''
Command Line Parser.
'''
parser = argparse.ArgumentParser( description='Generat... | [((275, 368), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate offset field between two Sentinel swaths"""'}), "(description=\n 'Generate offset field between two Sentinel swaths')\n", (298, 368), False, 'import argparse\n'), ((1151, 1175), 'isceobj.createSlcImage', 'isceobj.cr... |
sunshot/LeetCode | 27. Remove Element/solution2.py | 8f6503201831055f1d49ed3abb25be44a13ec317 | from typing import List
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
if not nums:
return 0
curr = 0
n = len(nums)
while curr < n:
if nums[curr] == val:
nums[curr] = nums[n-1]
n -= 1
else... | [] |
Granjow/platformio-core | platformio/commands/home/run.py | 71ae579bc07b2e11fec16acda482dea04bc3a359 | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [((2120, 2166), 'starlette.responses.PlainTextResponse', 'PlainTextResponse', (['"""Server has been shutdown!"""'], {}), "('Server has been shutdown!')\n", (2137, 2166), False, 'from starlette.responses import PlainTextResponse\n'), ((2209, 2300), 'starlette.responses.PlainTextResponse', 'PlainTextResponse', (['"""Prot... |
stefb965/luci-py | appengine/components/components/machine_provider/rpc_messages.py | e0a8a5640c4104e5c90781d833168aa8a8d1f24d | # Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Messages for the Machine Provider API."""
# pylint: disable=unused-wildcard-import, wildcard-import
from protorpc import messages
from compo... | [((650, 688), 'protorpc.messages.StringField', 'messages.StringField', (['(1)'], {'required': '(True)'}), '(1, required=True)\n', (670, 688), False, 'from protorpc import messages\n'), ((738, 768), 'protorpc.messages.EnumField', 'messages.EnumField', (['Backend', '(2)'], {}), '(Backend, 2)\n', (756, 768), False, 'from ... |
carvalho-fdec/DesafioDSA | webscraping.py | fec9742bd77ddc3923ed616b6511cce87de48968 | # webscraping test
import urllib.request
from bs4 import BeautifulSoup
with urllib.request.urlopen('http://www.netvasco.com.br') as url:
page = url.read()
#print(page)
print(url.geturl())
print(url.info())
print(url.getcode())
# Analise o html na variável 'page' e armazene-o no formato Beautiful... | [((333, 367), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page', '"""html.parser"""'], {}), "(page, 'html.parser')\n", (346, 367), False, 'from bs4 import BeautifulSoup\n')] |
hongxu-jia/tensorboard | tensorboard/backend/event_processing/data_provider_test.py | 98d4dadc61fd5a0580bed808653c59fb37748893 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [((1874, 1902), 'tensorflow.compat.v1.enable_eager_execution', 'tf1.enable_eager_execution', ([], {}), '()\n', (1900, 1902), True, 'import tensorflow.compat.v1 as tf1\n'), ((21426, 21440), 'tensorflow.compat.v2.test.main', 'tf.test.main', ([], {}), '()\n', (21438, 21440), True, 'import tensorflow.compat.v2 as tf\n'), (... |
luyang1210/tensorflow | extras/amld/cloud/quickdraw_rnn/task.py | 948324f4cafdc97ae51c0e44fc1c28677a6e2e8a | """Experiment wrapper for training on Cloud ML."""
import argparse, glob, os
import tensorflow as tf
# From this package.
import model
def generate_experiment_fn(data_dir, train_batch_size, eval_batch_size,
train_steps, eval_steps, cell_size, hidden,
**experime... | [((1043, 1114), 'tensorflow.contrib.training.HParams', 'tf.contrib.training.HParams', ([], {'cell_size': 'cell_size', 'hidden': '(hidden or None)'}), '(cell_size=cell_size, hidden=hidden or None)\n', (1070, 1114), True, 'import tensorflow as tf\n'), ((1169, 1197), 'tensorflow.contrib.learn.RunConfig', 'tf.contrib.learn... |
johnggo/Codeforces-Solutions | A/116A.py | 4127ae6f72294b5781fb94c42b69cfef570aae42 | # Time: 310 ms
# Memory: 1664 KB
n = int(input())
e = 0
s = 0
for i in range(n):
s =s- eval(input().replace(' ', '-'))
e = max(e, s)
print(e)
| [] |
aferrall/redner | tests/test_serialize.py | be52e4105140f575f153d640ba889eb6e6015616 | import pyredner
import numpy as np
import torch
cam = pyredner.Camera(position = torch.tensor([0.0, 0.0, -5.0]),
look_at = torch.tensor([0.0, 0.0, 0.0]),
up = torch.tensor([0.0, 1.0, 0.0]),
fov = torch.tensor([45.0]), # in degree
c... | [((1526, 1577), 'pyredner.Scene', 'pyredner.Scene', (['cam', 'shapes', 'materials', 'area_lights'], {}), '(cam, shapes, materials, area_lights)\n', (1540, 1577), False, 'import pyredner\n'), ((1625, 1673), 'pyredner.Scene.load_state_dict', 'pyredner.Scene.load_state_dict', (['scene_state_dict'], {}), '(scene_state_dict... |
Shoobx/zope.publisher | src/zope/publisher/tests/test_requestdataproperty.py | 790e82045d7ae06146bd8c5e27139555b9ec1641 | ##############################################################################
#
# Copyright (c) 2001, 2002 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.
# TH... | [((1334, 1368), 'zope.publisher.base.RequestDataProperty', 'RequestDataProperty', (['TestDataGettr'], {}), '(TestDataGettr)\n', (1353, 1368), False, 'from zope.publisher.base import RequestDataProperty, RequestDataGetter, RequestDataMapper\n'), ((1384, 1419), 'zope.publisher.base.RequestDataProperty', 'RequestDataPrope... |
ahemphill/digitalbuildings | tools/scoring/dimensions/__init__.py | 56a03b0055f9f771c3ed0a962f6bfb2b1d968947 | """ Enable import """
from os import path
import sys
sys.path.append(
path.abspath(path.join('tools', 'validators', 'instance_validator')))
| [((89, 143), 'os.path.join', 'path.join', (['"""tools"""', '"""validators"""', '"""instance_validator"""'], {}), "('tools', 'validators', 'instance_validator')\n", (98, 143), False, 'from os import path\n')] |
drorvinkler/thornfield | src/thornfield/caches/cache_compression_decorator.py | 3c5bb8afaa96097bc71cccb119394a0f351d828f | from typing import Callable, AnyStr, Optional
from zlib import compress as default_compress, decompress as default_decompress
from .cache import Cache
from ..constants import NOT_FOUND
class CacheCompressionDecorator(Cache):
def __init__(
self,
cache: Cache,
compress: Optional[Callable[[s... | [((1403, 1427), 'zlib.decompress', 'default_decompress', (['data'], {}), '(data)\n', (1421, 1427), True, 'from zlib import compress as default_compress, decompress as default_decompress\n')] |
kdkasad/manim | manim/mobject/vector_field.py | 249b1dcab0f18a43e953b5fda517734084c0a941 | """Mobjects representing vector fields."""
__all__ = [
"VectorField",
"ArrowVectorField",
"StreamLines",
]
import itertools as it
import random
from math import ceil, floor
from typing import Callable, Iterable, Optional, Sequence, Tuple, Type
import numpy as np
from colour import Color
from PIL import I... | [((13292, 13313), 'numpy.zeros', 'np.zeros', (['(ph, pw, 3)'], {}), '((ph, pw, 3))\n', (13300, 13313), True, 'import numpy as np\n'), ((13332, 13364), 'numpy.linspace', 'np.linspace', (['(-fw / 2)', '(fw / 2)', 'pw'], {}), '(-fw / 2, fw / 2, pw)\n', (13343, 13364), True, 'import numpy as np\n'), ((13383, 13415), 'numpy... |
dan-starkware/marshmallow_dataclass | marshmallow_dataclass/__init__.py | 25c3e041d8c6a87d740984e57a5bd29b768afbf8 | """
This library allows the conversion of python 3.7's :mod:`dataclasses`
to :mod:`marshmallow` schemas.
It takes a python class, and generates a marshmallow schema for it.
Simple example::
from marshmallow import Schema
from marshmallow_dataclass import dataclass
@dataclass
class Point:
x:flo... | [((1344, 1357), 'typing.TypeVar', 'TypeVar', (['"""_U"""'], {}), "('_U')\n", (1351, 1357), False, 'from typing import Any, Callable, Dict, List, Mapping, Optional, Set, Tuple, Type, TypeVar, Union, cast, overload\n'), ((8970, 9016), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'MAX_CLASS_SCHEMA_CACHE_SIZE'}), '... |
TheSin-/electrum-trc | electrum_trc/scripts/txradar.py | d2f5b15fd4399a9248cce0d63e20128f3f54e69c | #!/usr/bin/env python3
import sys
import asyncio
from electrum_trc.network import filter_protocol, Network
from electrum_trc.util import create_and_start_event_loop, log_exceptions
try:
txid = sys.argv[1]
except:
print("usage: txradar txid")
sys.exit(1)
loop, stopping_fut, loop_thread = create_and_star... | [((305, 334), 'electrum_trc.util.create_and_start_event_loop', 'create_and_start_event_loop', ([], {}), '()\n', (332, 334), False, 'from electrum_trc.util import create_and_start_event_loop, log_exceptions\n'), ((345, 354), 'electrum_trc.network.Network', 'Network', ([], {}), '()\n', (352, 354), False, 'from electrum_t... |
kagemeka/atcoder-submissions | jp.atcoder/dp/dp_g/24586988.py | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | import sys
import typing
import numpy as np
def solve(
n: int,
g: np.array,
) -> typing.NoReturn:
indeg = np.zeros(
n,
dtype=np.int64,
)
for v in g[:, 1]:
indeg[v] += 1
g = g[g[:, 0].argsort()]
i = np.searchsorted(
g[:, 0],
np.arange(n + 1)
)
q = [
v for v in range(n)
if... | [((115, 142), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'np.int64'}), '(n, dtype=np.int64)\n', (123, 142), True, 'import numpy as np\n'), ((347, 374), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'np.int64'}), '(n, dtype=np.int64)\n', (355, 374), True, 'import numpy as np\n'), ((791, 802), 'my_module.solve', 'solve'... |
jkerpe/TroubleBubble | starteMessung.py | 813ad797398b9f338f136bcb96c6c92186d92ebf | from datetime import datetime
from pypylon import pylon
import nimmAuf
import smbus2
import os
import argparse
import bestimmeVolumen
from threading import Thread
import time
programmstart = time.time()
# Argumente parsen (bei Aufruf im Terminal z.B. 'starteMessung.py -n 100' eingeben)
ap = argparse.ArgumentParser(de... | [((193, 204), 'time.time', 'time.time', ([], {}), '()\n', (202, 204), False, 'import time\n'), ((294, 481), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Skript zum Aufnehmen von Bildern der Teststrecke und der \n Volumenbestimmung von Luftblas... |
Sapfir0/web-premier-eye | application/services/decart.py | f060b01e98a923374ea60360ba133caaa654b6c7 | import os
import tempfile
def hasOnePointInside(bigRect, minRect): # хотя бы одна точка лежит внутри
minY, minX, maxY, maxX = bigRect
y1, x1, y2, x2 = minRect
a = (minY <= y1 <= maxY)
b = (minX <= x1 <= maxX)
c = (minY <= y2 <= maxY)
d = (minX <= x2 <= maxX)
return a or b or c or d
d... | [((1618, 1633), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)'], {}), '(1)\n', (1630, 1633), True, 'import matplotlib.pyplot as plt\n'), ((2025, 2054), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (2052, 2054), False, 'import tempfile\n'), ((2107, 2124), 'matplotlib.pyplot.save... |
agustinhenze/mibs.snmplabs.com | pysnmp/EXTREME-RTSTATS-MIB.py | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | #
# PySNMP MIB module EXTREME-RTSTATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, M... | [] |
BhavyeMathur/goopylib | goopylib/objects/_BBox.py | f9eb1458e9218a8dd4add6693ce70b804624bf91 | from goopylib.objects.GraphicsObject import GraphicsObject
from goopylib.styles import *
class BBox(GraphicsObject):
# Internal base class for objects represented by bounding box
# (opposite corners) Line segment is a degenerate case.
resizing_objects = []
def __init__(self, p1, p2, bounds=None, fi... | [((1010, 1107), 'goopylib.objects.GraphicsObject.GraphicsObject.__init__', 'GraphicsObject.__init__', (['self'], {'options': '()', 'cursor': 'cursor', 'layer': 'layer', 'bounds': 'bounds', 'tag': 'tag'}), '(self, options=(), cursor=cursor, layer=layer,\n bounds=bounds, tag=tag)\n', (1033, 1107), False, 'from goopyli... |
Mayner0220/Programmers | Graph/DFS&BFS.py | 42e4783a526506fb7d8208841a76201909ed5c5c | # https://www.acmicpc.net/problem/1260
n, m, v = map(int, input().split())
graph = [[0] * (n+1) for _ in range(n+1)]
visit = [False] * (n+1)
for _ in range(m):
R, C = map(int, input().split())
graph[R][C] = 1
graph[C][R] = 1
def dfs(v):
visit[v] = True
print(v, end=" ")
for i in range(1, n+... | [] |
Jahidul007/Python-Bootcamp | coding_intereview/1576. Replace All ?'s to Avoid Consecutive Repeating Characters.py | 3c870587465ff66c2c1871c8d3c4eea72463abda | class Solution:
def modifyString(self, s: str) -> str:
s = list(s)
for i in range(len(s)):
if s[i] == "?":
for c in "abc":
if (i == 0 or s[i-1] != c) and (i+1 == len(s) or s[i+1] != c):
s[i] = c
break ... | [] |
Fangyh09/pysteps | pysteps/tests/helpers.py | 9eb7f4ead0a946d98b7504d1bd66b18dc405ed51 | """
Testing helper functions
=======================
Collection of helper functions for the testing suite.
"""
from datetime import datetime
import numpy as np
import pytest
import pysteps as stp
from pysteps import io, rcparams
def get_precipitation_fields(num_prev_files=0):
"""Get a precipitation field from ... | [((392, 439), 'datetime.datetime.strptime', 'datetime.strptime', (['"""201505151630"""', '"""%Y%m%d%H%M"""'], {}), "('201505151630', '%Y%m%d%H%M')\n", (409, 439), False, 'from datetime import datetime\n'), ((798, 915), 'pysteps.io.archive.find_by_date', 'io.archive.find_by_date', (['date', 'root_path', 'path_fmt', 'fn_... |
ehiller/mobilecsp-v18 | modules/courses/courses.py | a59801c44c616d30f5e916d6771e479c8a9e88f7 | # Copyright 2012 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 ... | [((1277, 1356), 'models.roles.Roles.is_user_allowed', 'roles.Roles.is_user_allowed', (['app_context', 'custom_module', 'All_LOCALES_PERMISSION'], {}), '(app_context, custom_module, All_LOCALES_PERMISSION)\n', (1304, 1356), False, 'from models import roles\n'), ((1412, 1490), 'models.roles.Roles.is_user_allowed', 'roles... |
pyre/pyre | packages/merlin/protocols/PrefixLayout.py | 0f903836f52450bf81216c5dfdfdfebb16090177 | # -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2021 all rights reserved
# support
import merlin
# the manager of intermediate and final build products
class PrefixLayout(merlin.protocol, family="merlin.layouts.prefix"):
"""
The manager of the all build products, b... | [((400, 424), 'merlin.properties.path', 'merlin.properties.path', ([], {}), '()\n', (422, 424), False, 'import merlin\n'), ((483, 507), 'merlin.properties.path', 'merlin.properties.path', ([], {}), '()\n', (505, 507), False, 'import merlin\n'), ((573, 597), 'merlin.properties.path', 'merlin.properties.path', ([], {}), ... |
bradleyhenke/cortex | test/IECoreMaya/ImageConverterTest.py | f8245cc6c9464b1de9e6c6e57068248198e63de0 | ##########################################################################
#
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | [((2364, 2388), 'IECoreMaya.TestProgram', 'IECoreMaya.TestProgram', ([], {}), '()\n', (2386, 2388), False, 'import IECoreMaya\n'), ((2031, 2070), 'IECoreMaya.ToMayaImageConverter', 'IECoreMaya.ToMayaImageConverter', (['imageA'], {}), '(imageA)\n', (2062, 2070), False, 'import IECoreMaya\n'), ((2149, 2190), 'IECoreMaya.... |
PatrykNeubauer/NeMo | tests/core_ptl/check_for_ranks.py | 3ada744b884dba5f233f22c6991fc6092c6ca8d0 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [((2257, 2282), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (2280, 2282), False, 'import torch\n'), ((2297, 2382), 'pytorch_lightning.Trainer', 'Trainer', ([], {'gpus': 'num_gpus', 'accelerator': '"""ddp"""', 'logger': 'None', 'checkpoint_callback': 'None'}), "(gpus=num_gpus, accelerator='dd... |
Lofi-Lemonade/Python-Discord-Bot-Template | helpers/json_manager.py | 4cb79197c751c88100ad396adb38e88bf2a4d1ed | """"
Copyright © Krypton 2022 - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
This is a template to create your own discord bot in python.
Version: 4.1
"""
import json
def add_user_to_blacklist(user_id: int) -> None:
"""
This function will add a user based on its ID in the blacklist.json... | [((492, 507), 'json.load', 'json.load', (['file'], {}), '(file)\n', (501, 507), False, 'import json\n'), ((624, 660), 'json.dump', 'json.dump', (['file_data', 'file'], {'indent': '(4)'}), '(file_data, file, indent=4)\n', (633, 660), False, 'import json\n'), ((974, 989), 'json.load', 'json.load', (['file'], {}), '(file)... |
ColinKennedy/ways | tests/test_common.py | 1eb44e4aa5e35fb839212cd8cb1c59c714ba10d3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Make sure that generic functions work exactly as we expect.'''
# IMPORT STANDARD LIBRARIES
import unittest
# IMPORT WAYS LIBRARIES
from ways import common
class ParseTestCase(unittest.TestCase):
'''Test generic parsing-related functions.'''
def test_workin... | [((644, 679), 'ways.common.expand_string', 'common.expand_string', (['pattern', 'text'], {}), '(pattern, text)\n', (664, 679), False, 'from ways import common\n'), ((953, 994), 'ways.common.expand_string', 'common.expand_string', (['format_string', 'shot'], {}), '(format_string, shot)\n', (973, 994), False, 'from ways ... |
glibin/natasha | setup.py | 4f5c153f754759c189779f9879decd8d218356af | from setuptools import setup, find_packages
setup(
name='natasha',
version='0.2.0',
description='Named-entity recognition for russian language',
url='https://github.com/bureaucratic-labs/natasha',
author='Dmitry Veselov',
author_email='d.a.veselov@yandex.ru',
license='MIT',
classifiers=... | [((770, 785), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (783, 785), False, 'from setuptools import setup, find_packages\n')] |
OneScreenfulOfPython/screenfuls | GeneratePassword/generate_password_v2.py | ea4e378c8d9e530edadd4a3315fe9e8acc98460b | import os, sys
import random
import string
try:
# Make Python2 work like Python3
input = raw_input
except NameError:
# On Python3; already using input
pass
letters = string.ascii_letters
numbers = string.digits
punctuation = string.punctuation
def generate(password_length, at_least_one_letter, at_lea... | [((1951, 1977), 'random.shuffle', 'random.shuffle', (['characters'], {}), '(characters)\n', (1965, 1977), False, 'import random\n'), ((1283, 1305), 'random.choice', 'random.choice', (['letters'], {}), '(letters)\n', (1296, 1305), False, 'import random\n'), ((1404, 1426), 'random.choice', 'random.choice', (['numbers'], ... |
block42-blockchain-company/thornode-telegram-bot | bot/jobs/thorchain_node_jobs.py | 6478b1eb41e36c5fdd327b963b55343de1ce5337 | from constants.messages import get_node_health_warning_message, get_node_healthy_again_message
from handlers.chat_helpers import try_message_with_home_menu, try_message_to_all_users
from packaging import version
from service.utils import *
def check_thornodes(context):
chat_id = context.job.context['chat_id']
... | [((9092, 9136), 'handlers.chat_helpers.try_message_to_all_users', 'try_message_to_all_users', (['context'], {'text': 'text'}), '(context, text=text)\n', (9116, 9136), False, 'from handlers.chat_helpers import try_message_with_home_menu, try_message_to_all_users\n'), ((12838, 12885), 'handlers.chat_helpers.try_message_t... |
jjhenkel/dockerizeme | hard-gists/7578539/snippet.py | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | from pylab import *
from numpy import *
from numpy.linalg import solve
from scipy.integrate import odeint
from scipy.stats import norm, uniform, beta
from scipy.special import jacobi
a = 0.0
b = 3.0
theta=1.0
sigma=sqrt(theta/(2*(a+b+2)))
tscale = 0.05
invariant_distribution = poly1d( [-1 for x in range(int(a))], ... | [] |
lennykioko/Flask-social-network | forms.py | 15bfe1f7dca90074c0cbef62c5da9d5a25b5ce65 | # forms are not just about display, instead they are more of validation
# wtf forms protect our site against csrf attacks
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, TextAreaField
from wtforms.validators import (DataRequired, Regexp, ValidationError, Email,
Length, EqualTo... | [((450, 504), 'wtforms.validators.ValidationError', 'ValidationError', (['"""User with this name already exists."""'], {}), "('User with this name already exists.')\n", (465, 504), False, 'from wtforms.validators import DataRequired, Regexp, ValidationError, Email, Length, EqualTo\n'), ((605, 660), 'wtforms.validators.... |
flmnt/pantam | pantam_cli/utils/messages.py | da47d977e69ec410d0642b5ade1f2323c1b6b350 | from sys import stderr, stdout
from enum import Enum
from colored import fg, attr
PANTAM: str = fg("yellow") + attr("bold") + "PANTAM" + attr("reset")
colour_msg = lambda msg, colour: fg(colour) + attr("bold") + msg + attr("reset")
info_msg = lambda msg: colour_msg(msg, "blue")
success_msg = lambda msg: colour_msg(ms... | [((138, 151), 'colored.attr', 'attr', (['"""reset"""'], {}), "('reset')\n", (142, 151), False, 'from colored import fg, attr\n'), ((693, 739), 'sys.stdout.write', 'stdout.write', (["('%s%s%s' % (prefix, msg, suffix))"], {}), "('%s%s%s' % (prefix, msg, suffix))\n", (705, 739), False, 'from sys import stderr, stdout\n'),... |
zmc/ocs-ci | tests/manage/test_remove_mon_from_cluster.py | fcf51f3637f657689ba5a8ac869f2b14ac04b0cf | """
A Testcase to remove mon from
when I/O's are happening.
Polarion-ID- OCS-355
"""
import logging
import pytest
from ocs_ci.ocs import ocp, constants
from ocs_ci.framework.testlib import tier4, ManageTest
from ocs_ci.framework import config
from ocs_ci.ocs.resources import pod
from tests.helpers import run_io_with... | [((499, 526), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (516, 526), False, 'import logging\n'), ((530, 565), 'ocs_ci.utility.retry.retry', 'retry', (['CephHealthException', '(8)', '(3)', '(1)'], {}), '(CephHealthException, 8, 3, 1)\n', (535, 565), False, 'from ocs_ci.utility.retry im... |
Caaz/smartystreets-python-sdk | smartystreets_python_sdk/us_autocomplete_pro/client.py | f56cd00d29861bde297143c128f79a4b1d89541c | from smartystreets_python_sdk import Request
from smartystreets_python_sdk.exceptions import SmartyException
from smartystreets_python_sdk.us_autocomplete_pro import Suggestion, geolocation_type
class Client:
def __init__(self, sender, serializer):
"""
It is recommended to instantiate this class u... | [((1178, 1187), 'smartystreets_python_sdk.Request', 'Request', ([], {}), '()\n', (1185, 1187), False, 'from smartystreets_python_sdk import Request\n'), ((684, 760), 'smartystreets_python_sdk.exceptions.SmartyException', 'SmartyException', (['"""Send() must be passed a Lookup with the search field set."""'], {}), "('Se... |
Saritasa/mssqlvc | mssqlvc.py | 836caeea59cc0ed23234687b94062e007707c603 | # -*- coding: utf-8 -*-
"""
mssqlvc
~~~~~~~
Database version control utility for Microsoft SQL Server. See README.md for more information.
Licensed under the BSD license. See LICENSE file in the project root for full license information.
"""
import argparse
import datetime
import io
import logging
im... | [((519, 562), 'clr.AddReference', 'clr.AddReference', (['"""Microsoft.SqlServer.Smo"""'], {}), "('Microsoft.SqlServer.Smo')\n", (535, 562), False, 'import clr\n'), ((563, 610), 'clr.AddReference', 'clr.AddReference', (['"""Microsoft.SqlServer.SqlEnum"""'], {}), "('Microsoft.SqlServer.SqlEnum')\n", (579, 610), False, 'i... |
KshitizSharmaV/Quant_Platform_Python | lib/python3.6/site-packages/statsmodels/iolib/tests/test_table_econpy.py | d784aa0604d8de5ba5ca0c3a171e3556c0cd6b39 | '''
Unit tests table.py.
:see: http://docs.python.org/lib/minimal-example.html for an intro to unittest
:see: http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html
:see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292
'''
from __future__ import absolute_import
from statsmodel... | [((619, 643), 'statsmodels.iolib.table.default_latex_fmt.copy', 'default_latex_fmt.copy', ([], {}), '()\n', (641, 643), False, 'from statsmodels.iolib.table import default_latex_fmt\n'), ((656, 679), 'statsmodels.iolib.table.default_html_fmt.copy', 'default_html_fmt.copy', ([], {}), '()\n', (677, 679), False, 'from sta... |
MrDelik/core | homeassistant/components/todoist/types.py | 93a66cc357b226389967668441000498a10453bb | """Types for the Todoist component."""
from __future__ import annotations
from typing import TypedDict
class DueDate(TypedDict):
"""Dict representing a due date in a todoist api response."""
date: str
is_recurring: bool
lang: str
string: str
timezone: str | None
| [] |
corneliusroemer/pyzstd | src/c/c_pyzstd.py | 06f14ad29735d9ae85c188703dcb64c24686c4f2 | from collections import namedtuple
from enum import IntEnum
from ._zstd import *
from . import _zstd
__all__ = (# From this file
'compressionLevel_values', 'get_frame_info',
'CParameter', 'DParameter', 'Strategy',
# From _zstd
'ZstdCompressor', 'RichMemZstdCompressor',
... | [((752, 799), 'collections.namedtuple', 'namedtuple', (['"""values"""', "['default', 'min', 'max']"], {}), "('values', ['default', 'min', 'max'])\n", (762, 799), False, 'from collections import namedtuple\n'), ((1003, 1067), 'collections.namedtuple', 'namedtuple', (['"""frame_info"""', "['decompressed_size', 'dictionar... |
quacksawbones/galaxy-1 | test/unit/data/model/mapping/common.py | 65f7259b29d3886e526d9be670c60d9da9fbe038 | from abc import ABC, abstractmethod
from contextlib import contextmanager
from uuid import uuid4
import pytest
from sqlalchemy import (
delete,
select,
UniqueConstraint,
)
class AbstractBaseTest(ABC):
@pytest.fixture
def cls_(self):
"""
Return class under test.
Assumptions... | [((4284, 4291), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (4289, 4291), False, 'from uuid import uuid4\n'), ((2669, 2680), 'sqlalchemy.select', 'select', (['cls'], {}), '(cls)\n', (2675, 2680), False, 'from sqlalchemy import delete, select, UniqueConstraint\n'), ((1366, 1379), 'sqlalchemy.delete', 'delete', (['table'], ... |
chrisBrookes93/django-events-management | django_events/users/management/commands/create_default_su.py | 93886448a7bb85c8758324977ff67bcacc80bbec | from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
class Command(BaseCommand):
help = "Creates a default super user if one doesn't already exist. " \
"This is designed to be used in the docker-compose.yml to create an initial super user on deploymen... | [((556, 572), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (570, 572), False, 'from django.contrib.auth import get_user_model\n'), ((750, 766), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (764, 766), False, 'from django.contrib.auth import get_user_model\n')] |
zeroxoneb/antlir | antlir/bzl/image_layer.bzl | 811d88965610d16a5c85d831d317f087797ca732 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
An `image.layer` is a set of `feature` with some additional parameters. Its
purpose to materialize those `feature`s as a btrfs subvolume ... | [] |
jnthn/intellij-community | python/testData/debug/test_ignore_lib.py | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | from calendar import setfirstweekday
stopped_in_user_file = True
setfirstweekday(15) | [((65, 84), 'calendar.setfirstweekday', 'setfirstweekday', (['(15)'], {}), '(15)\n', (80, 84), False, 'from calendar import setfirstweekday\n')] |
ffreemt/promt-tr-free | promt_tr/__main__.py | ff20b0f176f9611fa5a834af5aeaa9ef6ca3a3ee | ''' __main__, to run:
python -m promt_tr
'''
import sys
from random import randint
from promt_tr import promt_tr, LANG_CODES
# pragma: no cover
def main():
'''main'''
from_lang = 'auto'
to_lang = 'zh'
text = 'test ' + str(randint(0, 10000))
if not sys.argv[1:]:
print('Provide some Engli... | [((898, 932), 'promt_tr.promt_tr', 'promt_tr', (['text', 'from_lang', 'to_lang'], {}), '(text, from_lang, to_lang)\n', (906, 932), False, 'from promt_tr import promt_tr, LANG_CODES\n'), ((242, 259), 'random.randint', 'randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (249, 259), False, 'from random import randint\n')... |
askoki/nfl_dpi_prediction | src/features/v3/proc_v3_n1_calc_distance.py | dc3256f24ddc0b6725eace2081d1fb1a7e5ce805 | import os
import sys
import pandas as pd
from datetime import datetime
from settings import RAW_DATA_DIR, DataV3, DATA_V3_SUBVERSION
from src.features.helpers.processing import add_missing_timestamp_values
from src.features.helpers.processing_v3 import get_closest_players, get_players_and_ball_indices, calculate_distan... | [((519, 545), 'settings.DataV3', 'DataV3', (['DATA_V3_SUBVERSION'], {}), '(DATA_V3_SUBVERSION)\n', (525, 545), False, 'from settings import RAW_DATA_DIR, DataV3, DATA_V3_SUBVERSION\n'), ((3598, 3645), 'src.features.helpers.processing_v3.normalize_according_to_play_direction', 'normalize_according_to_play_direction', ([... |
Rajpratik71/devel-scripts | annotate-preprocessed.py | 068285719a13b02889b1314361cc5bdb764d9a3a | #!/usr/bin/python
"""Annotates -E preprocessed source input with line numbers.
Read std input, then annotate each line with line number based on previous
expanded line directives from -E output. Useful in the context of compiler
debugging.
"""
import getopt
import os
import re
import sys
import script_utils as u
... | [] |
tekeburak/dam-occupancy-model | pages/lstm.py | f39d436bf27088068177245f0180cafaa56ad123 | import streamlit as st
import tensorflow as tf
import numpy
from utils.get_owm_data import get_open_weather_map_data
from utils.get_date import get_date_list_for_gmt
import plotly.graph_objects as go
from plotly import tools
import plotly.offline as py
import plotly.express as px
def app():
st.title("LSTM Model")
... | [((296, 318), 'streamlit.title', 'st.title', (['"""LSTM Model"""'], {}), "('LSTM Model')\n", (304, 318), True, 'import streamlit as st\n'), ((322, 362), 'streamlit.subheader', 'st.subheader', (['"""What does LSTM model do?"""'], {}), "('What does LSTM model do?')\n", (334, 362), True, 'import streamlit as st\n'), ((364... |
kamidev/autobuild_fst | fst_web/demo_settings.py | 6baffa955075ffe3c5f197789e9fd065fa74058e | # -*- coding: utf-8 -*-
import os
ROOT = os.path.abspath(os.path.dirname(__file__))
path = lambda *args: os.path.join(ROOT, *args)
""" Template for local settings of the FST webservice (fst_web)
Please edit this file and replace all generic values with values suitable to
your particular installation.
"""
# NOTE! Al... | [((1508, 1534), 'os.path.join', 'os.path.join', (['"""/dokument/"""'], {}), "('/dokument/')\n", (1520, 1534), False, 'import os\n'), ((1779, 1837), 'os.path.join', 'os.path.join', (['"""http://127.0.0.1:8000"""', 'FST_INSTANCE_PREFIX'], {}), "('http://127.0.0.1:8000', FST_INSTANCE_PREFIX)\n", (1791, 1837), False, 'impo... |
joaocamargo/estudos-python | BookingScraper-joao_v2/BookingScraper/airbnb.py | c5fbf59a1f06131d9789dca7dbdfdcf2200d0227 | #! /usr/bin/env python3.6
import argparse
import argcomplete
from argcomplete.completers import ChoicesCompleter
from argcomplete.completers import EnvironCompleter
import requests
from bthread import BookingThread
from bs4 import BeautifulSoup
from file_writer import FileWriter
hotels = []
def get_countries():
... | [((2042, 2173), 'requests.get', 'requests.get', (['url'], {'headers': "{'User-Agent':\n 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/48.0'\n }"}), "(url, headers={'User-Agent':\n 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/48.0'\n })\n", (2054, 2173... |
valurhrafn/chromium-sync | main.py | df5e3299d179fc47ff34d1a95409383f46aac4d4 | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | [((2721, 2905), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/', MainHandler), ('/GetUser/', GetUser), ('/HasData/', HasData), (\n '/chrome-sync/command/', PostData), ('/GetSyncData/', GetSyncData)]"], {'debug': '(True)'}), "([('/', MainHandler), ('/GetUser/', GetUser), (\n '/HasData/', HasData), (... |
dneise/Comet | comet/service/subscriber.py | abaa0da65d69f90a5262d81416477b4e71deb2ad | # Comet VOEvent Broker.
from twisted.application.internet import ClientService
from comet.protocol.subscriber import VOEventSubscriberFactory
__all__ = ["makeSubscriberService"]
def makeSubscriberService(endpoint, local_ivo, validators, handlers, filters):
"""Create a reconnecting VOEvent subscriber service.
... | [((1300, 1366), 'comet.protocol.subscriber.VOEventSubscriberFactory', 'VOEventSubscriberFactory', (['local_ivo', 'validators', 'handlers', 'filters'], {}), '(local_ivo, validators, handlers, filters)\n', (1324, 1366), False, 'from comet.protocol.subscriber import VOEventSubscriberFactory\n'), ((1381, 1413), 'twisted.ap... |
bopopescu/build | scripts/master/cros_try_job_git.py | 4e95fd33456e552bfaf7d94f7d04b19273d1c534 | # Copyright (c) 2012 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.
import base64
import json
import os
import re
import shutil
import zlib
from StringIO import StringIO
try:
# Create a block to work around evil sys.m... | [((1143, 1177), 're.compile', 're.compile', (['"""^[a-zA-Z][\\\\w-]+\\\\w$"""'], {}), "('^[a-zA-Z][\\\\w-]+\\\\w$')\n", (1153, 1177), False, 'import re\n'), ((4707, 4811), 'master.try_job_base.BadJobfile', 'BadJobfile', (['"""Cannot translate --remote-patches from tryjob v.2 to v.3. Please run repo sync."""'], {}), "(... |
Hellofafar/Leetcode | Medium/515.py | 7a459e9742958e63be8886874904e5ab2489411a | # ------------------------------
# 515. Find Largest Value in Each Tree Row
#
# Description:
# You need to find the largest value in each row of a binary tree.
# Example:
# Input:
# 1
# / \
# 3 2
# / \ \
# 5 3 9
# Output: [1, 3, 9]
#
# Version: 1.0
# 12/22/18 by Jia... | [] |
lachmanfrantisek/opsmop | opsmop/meta/docs/exparser.py | 562ae2d753ff84b3d794a6815d0436753e82d2a0 | # Copyright 2018 Michael DeHaan LLC, <michael@michaeldehaan.net>
#
# 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 app... | [((1598, 1624), 'os.path.basename', 'os.path.basename', (['filename'], {}), '(filename)\n', (1614, 1624), False, 'import os\n')] |
sheunl/Compiler_Tests | pylox/TokenType.py | 18c5e0568bc39a60094f3e44943ac252c279ffb9 | from enum import Enum
class T(Enum):
#single character Tokens
LEFT_PAREN =1
RIGHT_PAREN =2
LEFT_BRACE = 3
RIGHT_BRACE = 4
COMMA = 5
DOT = 6
MINUS = 7
PLUS = 8
SEMICOLON = 9
SLASH = 10
STAR = 11
#one or two character tokens
BANG = 12
BANG_EQUAL = 13
EQ... | [] |
dios-game/dios-cocos | src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/framework/framework_add.py | b7fbcbafe02f516ef18fdb64b4519dbf806303fc |
import cocos
from MultiLanguage import MultiLanguage
from package.helper import ProjectHelper
class FrameworkAdd(cocos.CCPlugin):
@staticmethod
def plugin_name():
return "add-framework"
@staticmethod
def brief_description():
return MultiLanguage.get_string('FRAMEWORK_ADD_BRIEF')
... | [((269, 316), 'MultiLanguage.MultiLanguage.get_string', 'MultiLanguage.get_string', (['"""FRAMEWORK_ADD_BRIEF"""'], {}), "('FRAMEWORK_ADD_BRIEF')\n", (293, 316), False, 'from MultiLanguage import MultiLanguage\n'), ((832, 867), 'package.helper.ProjectHelper.get_current_project', 'ProjectHelper.get_current_project', ([]... |
f-grimaldi/explain_ML | src/utils.py | 00892675be32bebd023b274270ccb05b798fb388 | from matplotlib import colors
import numpy as np
class SaveOutput:
def __init__(self):
self.outputs = []
def __call__(self, module, module_in, module_out):
self.outputs.append(module_out)
def clear(self):
self.outputs = []
class MidpointNormalize(colors.Normalize):
def __init... | [((417, 466), 'matplotlib.colors.Normalize.__init__', 'colors.Normalize.__init__', (['self', 'vmin', 'vmax', 'clip'], {}), '(self, vmin, vmax, clip)\n', (442, 466), False, 'from matplotlib import colors\n'), ((737, 759), 'numpy.interp', 'np.interp', (['value', 'x', 'y'], {}), '(value, x, y)\n', (746, 759), True, 'impor... |
erkyrath/tworld | lib/two/mongomgr.py | 9f5237771196b03753d027277ffc296e25fd7425 | """
Manage the connection to the MongoDB server.
"""
import tornado.gen
import tornado.ioloop
import motor
class MongoMgr(object):
def __init__(self, app):
# Keep a link to the owning application.
self.app = app
self.log = self.app.log
# This will be the Motor (MongoDB) c... | [((2452, 2484), 'motor.MotorClient', 'motor.MotorClient', ([], {'tz_aware': '(True)'}), '(tz_aware=True)\n', (2469, 2484), False, 'import motor\n'), ((1957, 1999), 'motor.Op', 'motor.Op', (['self.mongo.admin.command', '"""ping"""'], {}), "(self.mongo.admin.command, 'ping')\n", (1965, 1999), False, 'import motor\n'), ((... |
hugopibernat/BayesianABTestAnalysis | code/examples/example_binomial_and_log_normal_abtest.py | 026960524f5313f4a734f30fd447a5731be802e0 | #################################################
####### Author: Hugo Pibernat #######
####### Contact: hugopibernat@gmail.com #######
####### Date: April 2014 #######
#################################################
from bayesianABTest import sampleSuccessRateForBinomial, sampleMeanF... | [] |
airslate-oss/python-airslate | tests/models/test_documents.py | 0f7fe6321b1c2e6875a02dfecb5ffa07a361bb1d | # This file is part of the airslate.
#
# Copyright (c) 2021 airSlate, Inc.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
from airslate.models.documents import UpdateFields
from airslate.entities.fields import Field
def test_empty_update... | [((352, 366), 'airslate.models.documents.UpdateFields', 'UpdateFields', ([], {}), '()\n', (364, 366), False, 'from airslate.models.documents import UpdateFields\n'), ((478, 490), 'airslate.entities.fields.Field', 'Field', (['"""123"""'], {}), "('123')\n", (483, 490), False, 'from airslate.entities.fields import Field\n... |
rseed42/labyrinth | sim/dynamicobject.py | 1cd4dc74c67b1b76972e1e048a7fce0c13955e7d | class DynamicObject(object):
def __init__(self, name, id_):
self.name = name
self.id = id_
| [] |
meysam81/sheypoor | app/main.py | aa67e20646ebc4143b83968f60c0b28c2ad340a1 | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app import api
from app.core.config import config
app = FastAPI(title="Sheypoor")
# Set all CORS enabled origins
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
... | [((142, 167), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""Sheypoor"""'}), "(title='Sheypoor')\n", (149, 167), False, 'from fastapi import FastAPI\n')] |
Indy2222/mbg-codon-usage | cdnu/ccds.py | d415076a8150cd712010c0389c71ef22ba9ad850 | from typing import List, NamedTuple
CCDS_FILE = 'CCDS.current.txt'
CHROMOSOMES = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22',
'X', 'Y')
class CdsPos(NamedTuple):
ccds_id: str
indexes: list
"""2-t... | [] |
ITMO-NSS-team/GEFEST | test/test_resolve_errors.py | 72bb61cf3fbb9f87fe3dcd48b71f3e84dd23b669 | import pytest
from copy import deepcopy
from gefest.core.structure.point import Point
from gefest.core.structure.polygon import Polygon
from gefest.core.structure.structure import Structure
from gefest.core.algs.postproc.resolve_errors import *
from gefest.core.algs.geom.validation import *
# marking length and width... | [((1059, 1094), 'gefest.core.structure.structure.Structure', 'Structure', (['[unclosed_triangle_poly]'], {}), '([unclosed_triangle_poly])\n', (1068, 1094), False, 'from gefest.core.structure.structure import Structure\n'), ((1319, 1346), 'gefest.core.structure.structure.Structure', 'Structure', (['[incorrect_poly]'], {... |
davla/i3-live-tree | tests/mocks.py | 8dc3917afdd09f53f7cf39653c2bf12cb0200983 | from unittest.mock import MagicMock, Mock
from i3ipc.aio import Con
import i3_live_tree.tree_serializer # noqa: F401
class MockConSerializer(Mock, Con):
"""Mock a generic i3ipc.aio.Con for serialization purposes
This Mock is meant to ease testing of i3ipc.aio.Con serialization methods,
which are mokey... | [((821, 857), 'unittest.mock.Mock.__init__', 'Mock.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (834, 857), False, 'from unittest.mock import MagicMock, Mock\n')] |
nested-tech/hvac | hvac/api/secrets_engines/gcp.py | 2a58ac9850b882e43c1617ae6b0ea93104c99794 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Gcp methods module."""
from hvac import exceptions
from hvac.api.vault_api_base import VaultApiBase
from hvac.constants.gcp import DEFAULT_MOUNT_POINT, ALLOWED_CREDS_ENDPOINTS
class Gcp(VaultApiBase):
def generate_credentials(self, roleset, endpoint='key', mount_p... | [] |
poolpitako/ypricemagic | ypricemagic/uniswap.py | 882aa2071a918937e77e0b85e5f52191a4714d28 | import token
from tokenize import tokenize
from brownie import Contract, chain
from brownie.exceptions import ContractNotFound
from cachetools.func import ttl_cache
from .utils.cache import memory
from .utils.multicall2 import fetch_multicall
from .interfaces.ERC20 import ERC20ABI
import ypricemagic.magic
import yprice... | [((3820, 3840), 'cachetools.func.ttl_cache', 'ttl_cache', ([], {'ttl': '(36000)'}), '(ttl=36000)\n', (3829, 3840), False, 'from cachetools.func import ttl_cache\n'), ((5836, 5854), 'cachetools.func.ttl_cache', 'ttl_cache', ([], {'ttl': '(600)'}), '(ttl=600)\n', (5845, 5854), False, 'from cachetools.func import ttl_cach... |
haodingkui/semeval2020-task5-subtask1 | configs/configuration_textrnn.py | bfd0c808c6b1de910d6f58ea040a13442b4bcdca | """ TextRNN model configuration """
class TextRNNConfig(object):
def __init__(
self,
vocab_size=30000,
pretrained_embedding=None,
embedding_matrix=None,
embedding_dim=300,
embedding_dropout=0.3,
lstm_hidden_size=128,
output_dim=1,
**kwargs
... | [] |
akorzunin/telegram_auction_bot | settings/debug_members.py | d4d5042614ea11f8085815d8f9fb8b6fbebcfab0 | DEBUG_MEMBER_LIST = [
503131177,
] | [] |
JiazeWang/SP-GAN | metrics/pointops/pointops_util.py | 455003f78b1160ebe0a2056005b069808c0df35b | from typing import Tuple
import torch
from torch.autograd import Function
import torch.nn as nn
from metrics.pointops import pointops_cuda
import numpy as np
class FurthestSampling(Function):
@staticmethod
def forward(ctx, xyz, m):
"""
input: xyz: (b, n, 3) and n > m, m: int32
outpu... | [((12487, 12517), 'torch.clamp', 'torch.clamp', (['dist', '(0.0)', 'np.inf'], {}), '(dist, 0.0, np.inf)\n', (12498, 12517), False, 'import torch\n'), ((425, 451), 'torch.cuda.IntTensor', 'torch.cuda.IntTensor', (['b', 'm'], {}), '(b, m)\n', (445, 451), False, 'import torch\n'), ((516, 576), 'metrics.pointops.pointops_c... |
rickdg/vivi | core/src/zeit/cms/content/caching.py | 16134ac954bf8425646d4ad47bdd1f372e089355 | from collections import defaultdict
from logging import getLogger
from operator import itemgetter
from os import environ
from time import time
from zope.cachedescriptors.property import Lazy as cachedproperty
from zeit.cms.content.sources import FEATURE_TOGGLES
from zope.component import getUtility
from zeit.connector.... | [((405, 424), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (414, 424), False, 'from logging import getLogger\n'), ((512, 545), 'os.environ.get', 'environ.get', (['"""CONTENT_CACHE_SIZE"""'], {}), "('CONTENT_CACHE_SIZE')\n", (523, 545), False, 'from os import environ\n'), ((562, 596), 'os.enviro... |
genialis/genesis-genapi | genesis/project.py | dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a | """Project"""
from __future__ import absolute_import, division, print_function, unicode_literals
class GenProject(object):
"""Genesais project annotation."""
def __init__(self, data, gencloud):
for field in data:
setattr(self, field, data[field])
self.gencloud = gencloud
... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.