max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
27. Remove Element/solution2.py | sunshot/LeetCode | 0 | 3600 | <gh_stars>0
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
... | 3.71875 | 4 |
platformio/commands/home/run.py | Granjow/platformio-core | 4,744 | 3601 | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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... | 1.523438 | 2 |
appengine/components/components/machine_provider/rpc_messages.py | stefb965/luci-py | 1 | 3602 | # 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... | 1.90625 | 2 |
webscraping.py | carvalho-fdec/DesafioDSA | 0 | 3603 | <reponame>carvalho-fdec/DesafioDSA
# 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... | 3.296875 | 3 |
tensorboard/backend/event_processing/data_provider_test.py | hongxu-jia/tensorboard | 1 | 3604 | # 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... | 1.421875 | 1 |
extras/amld/cloud/quickdraw_rnn/task.py | luyang1210/tensorflow | 1 | 3605 | <filename>extras/amld/cloud/quickdraw_rnn/task.py
"""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_s... | 2.484375 | 2 |
A/116A.py | johnggo/Codeforces-Solutions | 1 | 3606 | <filename>A/116A.py
# 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)
| 2.890625 | 3 |
tests/test_serialize.py | aferrall/redner | 1,146 | 3607 | 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... | 1.953125 | 2 |
src/zope/publisher/tests/test_requestdataproperty.py | Shoobx/zope.publisher | 3 | 3608 | <reponame>Shoobx/zope.publisher
##############################################################################
#
# 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 a... | 2.125 | 2 |
tools/scoring/dimensions/__init__.py | ahemphill/digitalbuildings | 0 | 3609 | <reponame>ahemphill/digitalbuildings
""" Enable import """
from os import path
import sys
sys.path.append(
path.abspath(path.join('tools', 'validators', 'instance_validator')))
| 1.117188 | 1 |
src/thornfield/caches/cache_compression_decorator.py | drorvinkler/thornfield | 2 | 3610 | 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... | 2.609375 | 3 |
manim/mobject/vector_field.py | kdkasad/manim | 2 | 3611 | """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... | 3.03125 | 3 |
marshmallow_dataclass/__init__.py | dan-starkware/marshmallow_dataclass | 0 | 3612 | """
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... | 3.09375 | 3 |
electrum_trc/scripts/txradar.py | TheSin-/electrum-trc | 1 | 3613 | <reponame>TheSin-/electrum-trc
#!/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... | 2.1875 | 2 |
jp.atcoder/dp/dp_g/24586988.py | kagemeka/atcoder-submissions | 1 | 3614 | 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... | 2.34375 | 2 |
starteMessung.py | jkerpe/TroubleBubble | 0 | 3615 | <filename>starteMessung.py
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 =... | 2.625 | 3 |
application/services/decart.py | Sapfir0/web-premier-eye | 0 | 3616 | 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... | 2.875 | 3 |
goopylib/objects/_BBox.py | BhavyeMathur/goopylib | 25 | 3617 | 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... | 2.8125 | 3 |
Graph/DFS&BFS.py | Mayner0220/Programmers | 1 | 3618 | # 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+... | 3.171875 | 3 |
coding_intereview/1576. Replace All ?'s to Avoid Consecutive Repeating Characters.py | Jahidul007/Python-Bootcamp | 2 | 3619 | 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 ... | 3.4375 | 3 |
pysteps/tests/helpers.py | Fangyh09/pysteps | 6 | 3620 | <reponame>Fangyh09/pysteps
"""
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 ... | 2.25 | 2 |
modules/courses/courses.py | ehiller/mobilecsp-v18 | 0 | 3621 | <reponame>ehiller/mobilecsp-v18<filename>modules/courses/courses.py
# 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.apach... | 1.78125 | 2 |
packages/merlin/protocols/PrefixLayout.py | pyre/pyre | 25 | 3622 | <gh_stars>10-100
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# (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, both final and inte... | 1.921875 | 2 |
test/IECoreMaya/ImageConverterTest.py | bradleyhenke/cortex | 386 | 3623 | <reponame>bradleyhenke/cortex
##########################################################################
#
# 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 ar... | 0.96875 | 1 |
tests/core_ptl/check_for_ranks.py | PatrykNeubauer/NeMo | 2 | 3624 | <filename>tests/core_ptl/check_for_ranks.py
# 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/licen... | 2.15625 | 2 |
helpers/json_manager.py | Lofi-Lemonade/Python-Discord-Bot-Template | 0 | 3625 | <gh_stars>0
""""
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 bl... | 3.0625 | 3 |
tests/test_common.py | ColinKennedy/ways | 2 | 3626 | #!/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... | 2.96875 | 3 |
setup.py | glibin/natasha | 1 | 3627 | <reponame>glibin/natasha<gh_stars>1-10
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='<NAME>',
author_email='<EMAIL>',
license='MIT',... | 1.25 | 1 |
GeneratePassword/generate_password_v2.py | OneScreenfulOfPython/screenfuls | 2 | 3628 | 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... | 4.15625 | 4 |
bot/jobs/thorchain_node_jobs.py | block42-blockchain-company/thornode-telegram-bot | 15 | 3629 | <reponame>block42-blockchain-company/thornode-telegram-bot
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_thornode... | 2.296875 | 2 |
hard-gists/7578539/snippet.py | jjhenkel/dockerizeme | 21 | 3630 | 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))], ... | 2.453125 | 2 |
forms.py | lennykioko/Flask-social-network | 1 | 3631 | # 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... | 3.34375 | 3 |
pantam_cli/utils/messages.py | flmnt/pantam | 2 | 3632 | <reponame>flmnt/pantam
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 = la... | 2.640625 | 3 |
tests/manage/test_remove_mon_from_cluster.py | zmc/ocs-ci | 0 | 3633 | """
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... | 2.015625 | 2 |
smartystreets_python_sdk/us_autocomplete_pro/client.py | Caaz/smartystreets-python-sdk | 0 | 3634 | <reponame>Caaz/smartystreets-python-sdk<filename>smartystreets_python_sdk/us_autocomplete_pro/client.py
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:
d... | 2.3125 | 2 |
mssqlvc.py | Saritasa/mssqlvc | 2 | 3635 | <reponame>Saritasa/mssqlvc<filename>mssqlvc.py
# -*- 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 argpa... | 1.617188 | 2 |
lib/python3.6/site-packages/statsmodels/iolib/tests/test_table_econpy.py | KshitizSharmaV/Quant_Platform_Python | 1 | 3636 | '''
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... | 2.578125 | 3 |
homeassistant/components/todoist/types.py | MrDelik/core | 30,023 | 3637 | <gh_stars>1000+
"""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
| 2.109375 | 2 |
src/c/c_pyzstd.py | corneliusroemer/pyzstd | 29 | 3638 | <filename>src/c/c_pyzstd.py
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', '... | 2.125 | 2 |
test/unit/data/model/mapping/common.py | quacksawbones/galaxy-1 | 1,085 | 3639 | 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... | 2.828125 | 3 |
django_events/users/management/commands/create_default_su.py | chrisBrookes93/django-events-management | 0 | 3640 | <reponame>chrisBrookes93/django-events-management
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-compos... | 2.421875 | 2 |
antlir/bzl/image_layer.bzl | zeroxoneb/antlir | 28 | 3641 | <gh_stars>10-100
# 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... | 2.03125 | 2 |
python/testData/debug/test_ignore_lib.py | jnthn/intellij-community | 2 | 3642 | from calendar import setfirstweekday
stopped_in_user_file = True
setfirstweekday(15) | 1.296875 | 1 |
promt_tr/__main__.py | ffreemt/promt-tr-free | 0 | 3643 | <filename>promt_tr/__main__.py
''' __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:]:
... | 3.3125 | 3 |
src/features/v3/proc_v3_n1_calc_distance.py | askoki/nfl_dpi_prediction | 0 | 3644 | 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... | 2.515625 | 3 |
annotate-preprocessed.py | Rajpratik71/devel-scripts | 0 | 3645 | #!/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
... | 2.984375 | 3 |
pages/lstm.py | tekeburak/dam-occupancy-model | 8 | 3646 | 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")
... | 3.15625 | 3 |
fst_web/demo_settings.py | kamidev/autobuild_fst | 0 | 3647 | # -*- 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... | 1.75 | 2 |
BookingScraper-joao_v2/BookingScraper/airbnb.py | joaocamargo/estudos-python | 1 | 3648 | <gh_stars>1-10
#! /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_co... | 2.53125 | 3 |
main.py | valurhrafn/chromium-sync | 4 | 3649 | #!/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... | 2.34375 | 2 |
comet/service/subscriber.py | dneise/Comet | 15 | 3650 | # 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.
... | 2.265625 | 2 |
scripts/master/cros_try_job_git.py | bopopescu/build | 0 | 3651 | # 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... | 1.734375 | 2 |
Medium/515.py | Hellofafar/Leetcode | 6 | 3652 | # ------------------------------
# 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... | 4.21875 | 4 |
opsmop/meta/docs/exparser.py | lachmanfrantisek/opsmop | 0 | 3653 | # Copyright 2018 <NAME> LLC, <<EMAIL>>
#
# 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 i... | 2.875 | 3 |
pylox/TokenType.py | sheunl/Compiler_Tests | 0 | 3654 | 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... | 3.21875 | 3 |
src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/framework/framework_add.py | dios-game/dios-cocos | 1 | 3655 | <reponame>dios-game/dios-cocos<gh_stars>1-10
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 MultiL... | 2.40625 | 2 |
src/utils.py | f-grimaldi/explain_ML | 1 | 3656 | 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... | 2.703125 | 3 |
lib/two/mongomgr.py | erkyrath/tworld | 38 | 3657 | <reponame>erkyrath/tworld
"""
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 wil... | 2.625 | 3 |
code/examples/example_binomial_and_log_normal_abtest.py | hugopibernat/BayesianABTestAnalysis | 0 | 3658 | #################################################
####### Author: <NAME> #######
####### Contact: <EMAIL> #######
####### Date: April 2014 #######
#################################################
from bayesianABTest import sampleSuccessRateForBinomial, sampleMeanForLogNormal, probabili... | 2.21875 | 2 |
tests/models/test_documents.py | airslate-oss/python-airslate | 3 | 3659 | <filename>tests/models/test_documents.py
# 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.fi... | 2.09375 | 2 |
sim/dynamicobject.py | rseed42/labyrinth | 0 | 3660 | class DynamicObject(object):
def __init__(self, name, id_):
self.name = name
self.id = id_
| 3.0625 | 3 |
app/main.py | meysam81/sheypoor | 0 | 3661 | <reponame>meysam81/sheypoor
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,... | 1.765625 | 2 |
cdnu/ccds.py | Indy2222/mbg-codon-usage | 0 | 3662 | <filename>cdnu/ccds.py
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
i... | 3.015625 | 3 |
test/test_resolve_errors.py | ITMO-NSS-team/GEFEST | 12 | 3663 | 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... | 2.1875 | 2 |
tests/mocks.py | davla/i3-live-tree | 1 | 3664 | 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... | 2.90625 | 3 |
hvac/api/secrets_engines/gcp.py | nested-tech/hvac | 0 | 3665 | #!/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... | 2.390625 | 2 |
ypricemagic/uniswap.py | poolpitako/ypricemagic | 0 | 3666 | 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... | 1.96875 | 2 |
configs/configuration_textrnn.py | haodingkui/semeval2020-task5-subtask1 | 2 | 3667 | """ 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
... | 2.828125 | 3 |
settings/debug_members.py | akorzunin/telegram_auction_bot | 0 | 3668 | <gh_stars>0
DEBUG_MEMBER_LIST = [
503131177,
] | 1.046875 | 1 |
metrics/pointops/pointops_util.py | JiazeWang/SP-GAN | 73 | 3669 | 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... | 2.5625 | 3 |
core/src/zeit/cms/content/caching.py | rickdg/vivi | 5 | 3670 | <reponame>rickdg/vivi
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 getUtilit... | 1.914063 | 2 |
genesis/project.py | genialis/genesis-genapi | 3 | 3671 | <reponame>genialis/genesis-genapi
"""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])
... | 2.53125 | 3 |
account/views.py | KimSoungRyoul/drf_unitteset_study_project | 0 | 3672 | <reponame>KimSoungRyoul/drf_unitteset_study_project<gh_stars>0
# Create your views here.
from django.db.models import QuerySet
from django.utils.decorators import method_decorator
from drf_yasg.utils import swagger_auto_schema
from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenti... | 2.03125 | 2 |
src/front-door/azext_front_door/_validators.py | Mannan2812/azure-cli-extensions | 207 | 3673 | <reponame>Mannan2812/azure-cli-extensions<gh_stars>100-1000
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------... | 1.992188 | 2 |
mimesis/data/int/development.py | DevAerial/mimesis | 0 | 3674 | <filename>mimesis/data/int/development.py
"""Provides all the data related to the development."""
LICENSES = [
"Apache License, 2.0 (Apache-2.0)",
"The BSD 3-Clause License",
"The BSD 2-Clause License",
"GNU General Public License (GPL)",
"General Public License (LGPL)",
"MIT License (MIT)",
... | 1.515625 | 2 |
docs/mathparse.py | pcmoritz/flow | 16 | 3675 | <filename>docs/mathparse.py
"""
A preliminary attempt at parsing an RST file's math syntax
in order to make math render as inline rather than display
mode. This doesn't work as of yet but might be useful.
It could, however, be not useful if there's a pandoc option
for converting .md to .rst that makes math inline and ... | 3.015625 | 3 |
lib/layout/primitives.py | tailhook/pyzza | 2 | 3676 | from layout import Shape, Widget
from flash.text.engine import TextBlock, TextElement
@package('layout')
class Poly(Shape):
__slots__ = ('fillcolor', 'sequence')
def __init__(self, name, fillcolor, seq, states):
super().__init__(name, states)
self.fillcolor = fillcolor
self.sequence = s... | 2.765625 | 3 |
tests/testing_server.py | ImportTaste/WebRequest | 0 | 3677 | <gh_stars>0
import traceback
import uuid
import socket
import logging
import os
import base64
import zlib
import gzip
import time
import datetime
from http import cookies
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from threading import Thread
import WebRequest
def capture_expe... | 2.28125 | 2 |
calcgrades.py | qrowsxi/calcgrades | 0 | 3678 | import csv
import math
import numpy as np
import pandas
import scipy.optimize
import sys
import argparse
def ineq_constraint_1(v):
return np.array([vi for vi in v])
def ineq_constraint_2(v):
return np.array([-vi + 30 for vi in v])
class WeightAverage:
def __init__(self, mean, csv):
self.df = ... | 3.03125 | 3 |
sdk/python/pulumi_google_native/testing/v1/test_matrix.py | AaronFriel/pulumi-google-native | 44 | 3679 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Unio... | 1.859375 | 2 |
View/View.py | MoriokaReimen/ConfigHeaderGenerator | 0 | 3680 | import tkinter as tk
import tkinter.messagebox
from Control import Control
class View:
def __init__(self, control : Control.Control):
self.control = control
# Init Window
self.root = tk.Tk()
self.root.title(u"Header File Generator")
self.root.geometry("700x800")
se... | 2.859375 | 3 |
tests/bugs/core_3355_test.py | FirebirdSQL/firebird-qa | 1 | 3681 | <filename>tests/bugs/core_3355_test.py
#coding:utf-8
#
# id: bugs.core_3355
# title: Wrong comparsion of DATE and TIMESTAMP if index is used
# decription:
# tracker_id: CORE-3355
# min_versions: ['2.1.5']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, i... | 1.84375 | 2 |
dags/download_decrypt_transfer_files.py | hms-dbmi/bch-pic-sure-airflow-dags | 0 | 3682 | <reponame>hms-dbmi/bch-pic-sure-airflow-dags
"""
@author: anilkdegala
"""
import os
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from datetime import date, timedelta, datetime
from collections import O... | 2.1875 | 2 |
keystone-moon/keystone/endpoint_policy/controllers.py | hashnfv/hashnfv-moon | 0 | 3683 | <reponame>hashnfv/hashnfv-moon<gh_stars>0
# Copyright 2014 IBM Corp.
#
# 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... | 1.6875 | 2 |
src/nibetaseries/cli/run.py | ipacheco-uy/NiBetaSeries | 1 | 3684 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -m nibetaser... | 1.65625 | 2 |
custom_components/senz/config_flow.py | astrandb/senz_hass | 2 | 3685 | <gh_stars>1-10
"""Config flow for SENZ WiFi."""
from __future__ import annotations
import logging
from typing import Any
import voluptuous as vol
from homeassistant.components import persistent_notification
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_entry_oauth2_flo... | 2.296875 | 2 |
astropy_helpers/git_helpers.py | bsipocz/astropy-helpers | 9 | 3686 | <reponame>bsipocz/astropy-helpers
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utilities for retrieving revision information from a project's git repository.
"""
# Do not remove the following comment; it is used by
# astropy_helpers.version_helpers to determine the beginning of the code in
# th... | 2.109375 | 2 |
src/sot_talos_balance/test/test_feet_admittance.py | imaroger/sot-talos-balance | 0 | 3687 | <reponame>imaroger/sot-talos-balance
'''Test feet admittance control'''
from sot_talos_balance.utils.run_test_utils import run_ft_calibration, run_test, runCommandClient
try:
# Python 2
input = raw_input # noqa
except NameError:
pass
run_test('appli_feet_admittance.py')
run_ft_calibration('robot.ftc')
i... | 2.046875 | 2 |
tests/test_db.py | davebryson/py-tendermint | 24 | 3688 | <reponame>davebryson/py-tendermint
import os
from tendermint.db import VanillaDB
from tendermint.utils import home_dir
def test_database():
dbfile = home_dir('temp', 'test.db')
db = VanillaDB(dbfile)
db.set(b'dave',b'one')
result = db.get(b'dave')
assert(b'one' == result)
db.set(b'dave',b'tw... | 2.46875 | 2 |
auth/tests/test_views.py | asb29/Redundant | 0 | 3689 | from django.test import TestCase
from django.test import Client
class RegisterTestCase(TestCase):
def test_register(self):
c = Client()
# on success redirects to /
response = c.post('/accounts/register/', {
'username': 'asdas',
'password1': '<PASSWORD>',
... | 2.875 | 3 |
projects/OneNet/onenet/head.py | iFighting/OneNet | 2 | 3690 | #
# Modified by <NAME>
# Contact: <EMAIL>
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
OneNet Transformer class.
Copy-paste from torch.nn.Transformer with modifications:
* positional encodings are passed in MHattention
* extra LN at the end of encoder is removed
* decoder re... | 2.328125 | 2 |
mermaid/utils.py | HastingsGreer/mermaid | 120 | 3691 | <gh_stars>100-1000
"""Various utility functions.
.. todo::
Reorganize this package in a more meaningful way.
"""
from __future__ import print_function
from __future__ import absolute_import
# from builtins import str
# from builtins import range
import torch
from torch.nn.parameter import Parameter
from torch.aut... | 1.851563 | 2 |
examples/io/plot_read_evoked.py | fmamashli/mne-python | 3 | 3692 | <filename>examples/io/plot_read_evoked.py
"""
==================================
Reading and writing an evoked file
==================================
This script shows how to read and write evoked datasets.
"""
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from mne import read_evokeds
from mne.datasets impo... | 2.8125 | 3 |
source/monkeyPatches/__init__.py | lukaszgo1/nvda | 19 | 3693 | <filename>source/monkeyPatches/__init__.py
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2021 NV Access Limited
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
from . import wxMonkeyPatches
applyWxMonkeyPatches = wxMonkeyPatches.apply
def ... | 1.539063 | 2 |
yt_dlp/extractor/ninenow.py | nxtreaming/yt-dlp | 11 | 3694 | <reponame>nxtreaming/yt-dlp<gh_stars>10-100
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
str_or_none,
try_get,
unified_strdate,
unified_timestamp,
)
class NineNowIE(InfoExtractor):
I... | 2.0625 | 2 |
apex/fp16_utils/fused_weight_norm.py | mcarilli/apex | 1 | 3695 | <gh_stars>1-10
import torch
from torch.autograd import Variable
from torch.autograd.function import Function, once_differentiable
import apex_C
def check_contig_cuda(tensors, names):
for tensor, name in zip(tensors, names):
if not tensor.is_contiguous():
raise RuntimeError(name+" with size {} i... | 2.484375 | 2 |
bzt/modules/grinder.py | gerardorf/taurus | 1 | 3696 | """
Module holds all stuff regarding Grinder tool usage
Copyright 2015 BlazeMeter 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 require... | 1.578125 | 2 |
test/Fortran/fixture/myfortran_flags.py | moroten/scons | 1,403 | 3697 | <reponame>moroten/scons<gh_stars>1000+
import getopt
import sys
comment = ('#' + sys.argv[1]).encode()
opts, args = getopt.getopt(sys.argv[2:], 'cf:o:xy')
optstring = ''
length = len(comment)
for opt, arg in opts:
if opt == '-o': out = arg
elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
infile =... | 2.5 | 2 |
zen_knit/organizer/__init__.py | Zen-Reportz/zen_knit | 30 | 3698 | <gh_stars>10-100
import io
import os
import base64
from pathlib import Path
from nbconvert import filters
from pygments.formatters.latex import LatexFormatter
from zen_knit import formattor
from zen_knit.data_types import ChunkOption, ExecutedData, OrganizedChunk, OrganizedData
from zen_knit.formattor.html_formatter ... | 2.109375 | 2 |
qibullet/robot_virtual.py | mcaniot/qibullet | 0 | 3699 | <filename>qibullet/robot_virtual.py
#!/usr/bin/env python
# coding: utf-8
import sys
import pybullet
from qibullet.camera import *
from qibullet.link import Link
from qibullet.joint import Joint
IS_VERSION_PYTHON_3 = sys.version_info[0] >= 3
class RobotVirtual:
"""
Mother class representing a virtual robot
... | 2.578125 | 3 |