max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
examples/mask_renderer.py | qaz734913414/insightface | 12,377 | 3227815 | import os, sys, datetime
import numpy as np
import os.path as osp
import cv2
import insightface
from insightface.app import MaskRenderer
from insightface.data import get_image as ins_get_image
if __name__ == "__main__":
#make sure that you have download correct insightface model pack.
#make sure that BFM.mat ... | 0 | 0 | 0 | 0 | 0 | 0 |
Concurrency/Observer Pattern/python/Launcher.py | jerryshueh/design-patterns | 294 | 3227830 | <filename>Concurrency/Observer Pattern/python/Launcher.py
import sys
sys.dont_write_bytecode = True;
from Subscriber import Subscriber
from Publisher import Publisher
def main():
pub = Publisher(['lunch', 'dinner'])
bob = Subscriber('Bob')
alice = Subscriber('Alice')
john = Subscriber('John')
p... | 0 | 0 | 0 | 0 | 0 | 0 |
sql_metadata/compat.py | dongsc1994/sql-metadata | 313 | 3227844 | """
This module provides a temporary compatibility layer
for legacy API dating back to 1.x version.
Change your old imports:
from sql_metadata import get_query_columns, get_query_tables
into:
from sql_metadata.compat import get_query_columns, get_query_tables
"""
# pylint:disable=missing-function-docstring
from ty... | 6 | 6 | 0 | 0 | 12 | 0 |
pyncm/apis/miniprograms/difm.py | asdMild/pyncm | 133 | 3227857 | '''最嗨电音、爵士电台 - DI.FM APIs'''
from . import WeapiCryptoRequest
@WeapiCryptoRequest
def GetCurrentPlayingTrackList(channelId: int=101,limit: int=10,source: int=0) -> tuple[str, dict[str,object]]:
'''移动端 - 小程序 - 获取当前某频道下正在播放的歌曲
Args:
channelId (int, optional): 频道 (channel) ID. Defaults to 101.
... | 6 | 4 | 0 | 0 | 10 | 0 |
cite2c/install.py | takluyver/cite2c | 259 | 3227867 | <filename>cite2c/install.py
#!/usr/bin/env python
from os.path import dirname, abspath, join as pjoin
from notebook.nbextensions import install_nbextension, enable_nbextension
from notebook.serverextensions import toggle_serverextension_python
def install_nbext():
print("Installing nbextension ...")
c2cdir = p... | 0 | 0 | 0 | 0 | 0 | 0 |
plot.py | vazhnov/MiBand2 | 538 | 3227873 | <filename>plot.py
import numpy as np
import pandas as pd
import sys
from stockstats import StockDataFrame
import matplotlib.pyplot as plt
df = pd.DataFrame.from_csv(sys.argv[1], index_col=None)
print (df.head())
df['time'] = pd.to_datetime(df['time'], unit='s')
df = df.set_index('time')
print (df.describe())
# plt.sub... | 0 | 0 | 0 | 0 | 0 | 0 |
doc_src/code_examples/custom_categories3.py | typh289/django-categories | 211 | 3227897 | <reponame>typh289/django-categories
from categories import models, settings
from categories.base import CategoryBase
class Category(CategoryBase):
thumbnail = models.FileField(
upload_to=settings.THUMBNAIL_UPLOAD_PATH,
null=True, blank=True,
storage=settings.THUMBNAIL_STORAGE,)
thumbna... | 0 | 0 | 0 | 0 | 0 | 0 |
dffml/skel/service/REPLACE_IMPORT_PACKAGE_NAME/misc.py | SGeetansh/dffml | 171 | 3227908 | from dffml.util.cli.cmd import CMD
from dffml.util.entrypoint import entrypoint
from dffml.base import config, field
@config
class MiscServicesConfig:
integer: int = field(
f"Port to do nothing with", default=0, required=True,
)
@entrypoint("misc")
class MiscService(CMD):
"""
Description of ... | 0 | 0 | 1 | 0 | 1 | 0 |
venv/Lib/site-packages/pandas/tests/indexes/multi/test_compat.py | ajayiagbebaku/NFL-Model | 28,899 | 3227909 | <reponame>ajayiagbebaku/NFL-Model
import numpy as np
import pytest
from pandas import MultiIndex
import pandas._testing as tm
def test_numeric_compat(idx):
with pytest.raises(TypeError, match="cannot perform __mul__"):
idx * 1
with pytest.raises(TypeError, match="cannot perform __rmul__"):
1... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/OpenSSL/rand.py | gilbertekalea/booking.com_crawler | 9,953 | 3227920 | <reponame>gilbertekalea/booking.com_crawler
"""
PRNG management routines, thin wrappers.
"""
from OpenSSL._util import lib as _lib
def add(buffer, entropy):
"""
Mix bytes from *string* into the PRNG state.
The *entropy* argument is (the lower bound of) an estimate of how much
randomness is contained... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch_ares/third_party/fast_adversarial/MNIST/evaluate_mnist.py | thu-ml/realsafe | 107 | 3227962 | <reponame>thu-ml/realsafe<gh_stars>100-1000
import argparse
import logging
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, Dataset
from mnist_net import... | 0 | 0 | 0 | 0 | 0 | 0 |
openstackclient/tests/unit/common/test_module.py | cloudification-io/python-openstackclient | 262 | 3227967 | # Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 | 0 | 0 | 0 | 0 | 0 |
checkov/kubernetes/checks/KubletRotateKubeletServerCertificate.py | niradler/checkov | 4,013 | 3227970 | <reponame>niradler/checkov<filename>checkov/kubernetes/checks/KubletRotateKubeletServerCertificate.py
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.kubernetes.base_spec_check import BaseK8Check
class KubletRotateKubeletServerCertificate(BaseK8Check):
def __init__(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
CondTools/SiStrip/test/SiStripApvGainRescaler_cfg.py | ckamtsikis/cmssw | 852 | 3227984 | <filename>CondTools/SiStrip/test/SiStripApvGainRescaler_cfg.py
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
process = cms.Process("Demo")
#prepare options
options = VarParsing.VarParsing("analysis")
options.register ('globalTag',
"92X_dataRun2_Prompt... | 0 | 0 | 0 | 0 | 0 | 0 |
xcenternet/model/callbacks.py | JuanchoWang/xcenternet | 171 | 3228009 | <filename>xcenternet/model/callbacks.py
import tensorflow as tf
from xcenternet.model.evaluation.mean_average_precision import MAP
class MAPValidationCallback(tf.keras.callbacks.Callback):
"""
Callback that allows us to calculate Mean Average Precision and write it to TensorBoard.
Tp be used on validati... | 0 | 0 | 0 | 0 | 0 | 0 |
Stock_Analysis/use_riskfolio.py | vhn0912/Finance | 441 | 3228011 | <filename>Stock_Analysis/use_riskfolio.py
import numpy as np
import pandas as pd
import yfinance as yf
import riskfolio.ConstraintsFunctions as cf
import matplotlib.pyplot as plt
import riskfolio.PlotFunctions as plf
import riskfolio.Portfolio as pf
yf.pdr_override()
# Date range
start = '2016-01-01'
end = '2019-12-3... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/highlighting_example.py | kail85/mpldatacursor | 165 | 3228014 | <gh_stars>100-1000
"""
An example of using a HighlightingDataCursor along with a custom formatter
formatter function to highlight the selected artist and display its label.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpldatacursor import HighlightingDataCursor
x = np.linspace(0, 10, 100)
fig, ax = plt... | 0 | 0 | 0 | 0 | 0 | 0 |
Smallcaps/Check Smallcap Consistency.py | justanotherfoundry/Glyphs-Scripts | 283 | 3228052 | <reponame>justanotherfoundry/Glyphs-Scripts
#MenuTitle: Check Smallcap Consistency
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Performs a few tests on your SC set and reports into the Macro window, especially kerning groups and glyph set.
"""
thisFont = Glyphs.... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577346_getattr_with_arbitrary_depth/recipe-577346.py | tdiprima/code | 2,023 | 3228054 | from __future__ import annotations
def multi_getattr(obj, attr, default: object | None = None) -> object:
"""
Get a named attribute from an object; multi_getattr(x, 'a.b.c.d') is
equivalent to x.a.b.c.d. When a default argument is given, it is
returned when any attribute in the chain doesn't exist; with... | 1 | 1 | 0 | 0 | 2 | 0 |
Caser/utils.py | jingxiufenghua/rec-model | 1,323 | 3228057 | <gh_stars>1000+
"""
Created on May 25, 2020
create implicit ml-1m dataset
@author: <NAME>
"""
import pandas as pd
import numpy as np
import random
from tqdm import tqdm
from tensorflow.keras.preprocessing.sequence import pad_sequences
def sparseFeature(feat, feat_num, embed_dim=4):
"""
create dictionary for... | 0 | 0 | 0 | 0 | 0 | 0 |
python/068 Text Justification.py | allandproust/leetcode-share | 156 | 3228065 | '''
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly L cha... | 0 | 1 | 0 | 0 | 1 | 0 |
Python-3/collections/namedtuple_example.py | ghiloufibelgacem/jornaldev | 1,139 | 3228111 | ## NOTE: Requires Python 3.7 or higher
from collections import namedtuple
emp1 = ('Pankaj', 35, 'Editor')
emp2 = ('David', 40, 'Author')
for p in [emp1, emp2]:
print(p)
for p in [emp1, emp2]:
print(p[0], 'is a', p[1], 'years old working as', p[2])
# pythonic way
for p in [emp1, emp2]:
print('%s is a %d... | 0 | 0 | 0 | 0 | 0 | 0 |
hs_odm2/management/commands/odm2-sync.py | tommac7/hydroshare | 178 | 3228119 | <filename>hs_odm2/management/commands/odm2-sync.py
"""This synchronizes the ODM variable class with the external website.
* By default, prints errors on stdout.
"""
from django.core.management.base import BaseCommand
from hs_odm2.models import ODM2Variable
class Command(BaseCommand):
help = "synchronize ODM2 va... | 0 | 0 | 0 | 0 | 0 | 0 |
research/audioset/vggish/vggish_smoke_test.py | gujralsanyam22/models | 82,518 | 3228143 | # Copyright 2017 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 applicab... | 0 | 0 | 0 | 0 | 0 | 0 |
seleniumwire/__main__.py | jspzyhl/selenium-wire | 975 | 3228173 | <reponame>jspzyhl/selenium-wire
import argparse
import logging
import signal
from argparse import RawDescriptionHelpFormatter
from seleniumwire import backend, utils
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
def standalone_proxy(port=0, addr='127.0.0.1'):
b = backend.create(
port=in... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_execution_styles.py | SJCosgrove/quantoipian | 412 | 3228221 | <gh_stars>100-1000
#
# Copyright 2014 Quantopian, 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... | 0 | 0 | 0 | 0 | 0 | 0 |
Code/load_images.py | zhoaa/Sign-Language-Interpreter-using-Deep-Learning | 266 | 3228254 | import cv2
from glob import glob
import numpy as np
import random
from sklearn.utils import shuffle
import pickle
import os
def pickle_images_labels() -> object:
images_labels = []
images = glob("gestures/*/*.jpg")
images.sort()
for image in images:
print(image)
label = image[image.find(os.sep)+1: image.rfind(... | 0 | 1 | 0 | 0 | 1 | 0 |
demos/fortnightly/main.py | Jonypr-code/KivyMD | 1,111 | 3228284 | <reponame>Jonypr-code/KivyMD
"""
MDFortnightly demo
=============
.. seealso::
`Material Design spec,
Fortnightly <https://material.io/design/material-studies/fortnightly.html#>`
Fortnightly is an app that covers the news on a variety of topics.
The app’s focus is on content, specifically article copy ... | 0 | 0 | 0 | 0 | 0 | 0 |
picoCTF-web/tests/integration/test_team.py | minhnq1618/picoCTF | 280 | 3228293 | <reponame>minhnq1618/picoCTF
"""Tests for the /api/v1/team endpoints."""
from pytest_mongo import factories
from pytest_redis import factories
from .common import ( # noqa (fixture)
ADMIN_DEMOGRAPHICS,
clear_db,
client,
decode_response,
get_csrf_token,
register_test_accounts,
TEACHER_DEMOGR... | 0 | 0 | 0 | 0 | 0 | 0 |
typed_python/compiler/codegen_helpers.py | APrioriInvestments/typed_python | 105 | 3228315 | <filename>typed_python/compiler/codegen_helpers.py
"""Common functions useful for generating python asts.
We do this because some language features are easier to implement by rewriting
certain parts of the code.
"""
import typed_python.python_ast as python_ast
def const(val):
"""Generate a python expression repr... | 0 | 0 | 0 | 0 | 0 | 0 |
gym_electric_motor/physical_systems/voltage_supplies.py | RaviPandey33/gym-electric-motor-1 | 179 | 3228332 | <gh_stars>100-1000
from gym_electric_motor.physical_systems.solvers import EulerSolver
import warnings
import numpy as np
class VoltageSupply:
"""Base class for all VoltageSupplies to be used in a SCMLSystem.
Parameter:
supply_range(Tuple(float,float)): Minimal and maximal possible value for... | 0 | 0 | 0 | 0 | 0 | 0 |
episodes/test_val_episode.py | caisarl76/savn | 169 | 3228338 | from __future__ import annotations
""" Contains the Episodes for Navigation. """
from datasets.environment import Environment
from utils.net_util import gpuify
from .basic_episode import BasicEpisode
import pickle
from datasets.data import num_to_name
class TestValEpisode(BasicEpisode):
""" Episode for Navigation... | 5 | 1 | 0 | 3 | 9 | 0 |
video-superresolution/tecogan/authors_scripts/download_test_data.py | AaratiAkkapeddi/nnabla-examples | 228 | 3228339 | # Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_308.py | ksvr444/daily-coding-problem | 1,921 | 3228345 | from __future__ import annotations
SYMBOLS = {'|', '&', '^'}
class Boolean:
def __init__(self, exp, val, fe, se):
self.exp = exp
self.val = val
self.fe = fe
self.se = se
def evaluator(arr) -> list[object] | object:
expr = "".join(arr)
if len(arr) == 1 or len(arr) == 3:
... | 0 | 2 | 0 | 0 | 2 | 0 |
src/oci/waas/models/waf_meter_datum.py | Manny27nyc/oci-python-sdk | 249 | 3228360 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... | 0 | 0 | 0 | 0 | 0 | 0 |
vakt/storage/migration.py | chuxuantinh/vakt | 132 | 3228369 | <gh_stars>100-1000
"""
Migration utilities for Storage Migrations
"""
from abc import ABCMeta, abstractmethod
import logging
log = logging.getLogger(__name__)
class Migration(metaclass=ABCMeta):
"""
Manager for maintaining various migration actions of the storage: schema, indices, etc
"""
@propert... | 0 | 0 | 0 | 0 | 0 | 0 |
models/layers/mconv3d.py | BotanAtomic/anomaly-detection | 179 | 3228404 | import torch
import torch.nn as nn
from models.base import BaseModule
class MaskedConv3d(BaseModule, nn.Conv3d):
"""
Implements a Masked Convolution 3D.
This is a 3D Convolution that cannot access future frames.
"""
def __init__(self, *args, **kwargs):
super(MaskedConv3d, self).__init__(*... | 0 | 1 | 0 | 0 | 1 | 0 |
Utility/Python/import_py3package_from_pypi.py | vikrant4u2/runbooks | 107 | 3228437 | #!/usr/bin/env python3
"""
Imports python 3 packages from pypi.org
This Azure Automation runbook runs in Azure to import a package and its dependencies from pypi.org.
It requires the subscription id, resource group of the Automation account, Automation name, and package name as arguments.
Args:
subscription_i... | 0 | 4 | 0 | 0 | 4 | 0 |
transformer/greedy.py | aalikadic/transformer-location-prediction | 214 | 3228448 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# date: 2018-12-03 10:36
import torch
from torch.autograd import Variable
from .functional import subsequent_mask
def greedy_decode(model, src, src_mask, max_len, start_symbol):
memory = model.encode(src, src_mask)
ys = torch.ones(1, 1).fill_(start_symbol).type_as(s... | 0 | 0 | 0 | 0 | 0 | 0 |
opensfm/commands/compute_depthmaps.py | leejaeyong7/OpenSfM | 2,111 | 3228458 | <gh_stars>1000+
import logging
from opensfm import dataset
from opensfm import dense
logger = logging.getLogger(__name__)
class Command:
name = 'compute_depthmaps'
help = "Compute depthmap"
def add_arguments(self, parser):
parser.add_argument('dataset', help='dataset to process')
parser... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/ensemble/plot_gradient_boosting_oob.py | MaiRajborirug/scikit-learn | 50,961 | 3228463 | from __future__ import annotations
"""
======================================
Gradient Boosting Out-of-Bag estimates
======================================
Out-of-bag (OOB) estimates can be a useful heuristic to estimate
the "optimal" number of boosting iterations.
OOB estimates are almost identical to cross-validatio... | 1 | 2 | 0 | 0 | 3 | 0 |
code/inference.py | Kdeer/fake-voice-detection | 119 | 3228536 | import os
import numpy as np
import subprocess
from sklearn.metrics import f1_score, accuracy_score
from utils import *
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
data_dir = "../data/inference_data/"
mode = "unlabeled" # real, fake, or unlabeled
pretrain... | 0 | 0 | 0 | 0 | 0 | 0 |
django/contrib/formtools/tests/wizard/__init__.py | webjunkie/django | 285 | 3228571 | from django.contrib.formtools.tests.wizard.test_cookiestorage import TestCookieStorage
from django.contrib.formtools.tests.wizard.test_forms import FormTests, SessionFormTests, CookieFormTests
from django.contrib.formtools.tests.wizard.test_loadstorage import TestLoadStorage
from django.contrib.formtools.tests.wizard.n... | 0 | 0 | 0 | 0 | 0 | 0 |
ptb/scripts/PTB-release.py | mfernezir/YellowFin | 455 | 3228572 | from __future__ import print_function
import os, sys
import numpy as np
import tensorflow as tf
import cPickle as pickle
sys.path.append('../model')
from ptb_word_lm import *
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import sys
sys.path.append("../tuner_utils/")
from debug_plot import pl... | 0 | 0 | 0 | 0 | 0 | 0 |
3rd_party/AMGX/ci/containers/x86_64-ubuntu20.04-nvhpc20.9.py | RonRahaman/nekRS | 278 | 3228578 | """
AmgX base image: x86_64-ubuntu20.04-nvhpc20.9
"""
import posixpath
Stage0 += comment(__doc__, reformat=False)
Stage0 += baseimage(image='ubuntu:20.04')
compiler = nvhpc(eula=True, version='20.9', cuda_multi=False, cuda='11.0')
# WAR: nvhpc should be doing this
compiler.toolchain.CUDA_HOME = '/opt/nvidia/hpc_sdk/Li... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/conch/howto/listings/echoclient_ssh.py | Khymeira/twisted | 4,612 | 3228604 | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
if __name__ == "__main__":
import sys
import echoclient_ssh
from twisted.internet.task import react
react(echoclient_ssh.main, sys.argv[1:])
import getpass
import os
from twisted.conch.client.knownhosts i... | 0 | 4 | 2 | 0 | 6 | 0 |
test/integration/clirmatrix.py | seanmacavaney/ir_datasets | 149 | 3228611 | <reponame>seanmacavaney/ir_datasets<filename>test/integration/clirmatrix.py
import re
import unittest
import ir_datasets
from ir_datasets.formats import GenericDoc, GenericQuery, TrecQrel
from .base import DatasetIntegrationTest
_logger = ir_datasets.log.easy()
# Note: there's > 100k combinations here, so we are onl... | 0 | 0 | 0 | 0 | 0 | 0 |
td4a/controllers/retrieve.py | mihai-satmarean/td4a | 171 | 3228699 | <reponame>mihai-satmarean/td4a
""" /retrieve
"""
from flask import request, jsonify, Blueprint
from flask import current_app as app
from td4a.models.exception_handler import ExceptionHandler, HandledException
import requests
api_retrieve = Blueprint('api_retrieve', __name__) # pylint: disable=invalid-name
@ExceptionH... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/multi_bluetooth/ble_mtu.py | sebastien-riou/micropython | 13,648 | 3228707 | <gh_stars>1000+
# Test MTU exchange (initiated by both central and peripheral) and the effect on
# notify and write size.
# Seven connections are made (four central->peripheral, three peripheral->central).
#
# Test | Requested | Preferred | Result | Notes
# 0 | 300 (C) | 256 (P) | 256 |
# 1 | 300 (C) | ... | 0 | 0 | 0 | 0 | 0 | 0 |
Algorithms/Dynamic_Programming/Gauss_Easter_Date/Gauss_Easter_Date.py | arslantalib3/algo_ds_101 | 182 | 3228721 | import math
def Easter(Year) -> None:
# Gauss Easter Algorithm
a = Year % 19
b = Year % 4
c = Year % 7
k = math.floor(Year / 100)
p = math.floor((13 + 8 * k) / 25)
q = k/4
m = (15 - p + k - q) % 30
n = (4 + k - q) % 7
d = (19 * a + m) % 30
e = (2 * b + 4 * c + 6 * d + n) % 7... | 0 | 1 | 0 | 0 | 1 | 0 |
PYTHON/covid19_tracker.py | ayushyado/HACKTOBERFEST2021-2 | 125 | 3228723 | # importing tkinter
from tkinter import *
# initializing tkinter
root = Tk()
# setting geometry
root.geometry("350x350")
# setting title
root.title("Get Covid-19 Data Country Wise")
# function which will get covid data and will show it
def showdata():
# importing matplotlib which will be used to show data graphica... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/client/e2e/test_blobs.py | datapane/datapane | 481 | 3228731 | <reponame>datapane/datapane
import pickle
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from matplotlib import pyplot as plt
import datapane as dp
from tests import check_df_equal
from .common import check_name, code, deletable, gen_df, gen_name
pytestmark = pytest.mark.usefixtures("... | 0 | 0 | 0 | 0 | 0 | 0 |
patchluastr.py | astuder/lightroom-map-fix | 108 | 3228735 | # Copyright (c) 2018-2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | 1 | 4 | 1 | 6 | 12 | 0 |
official/recommendation/ranking/task_test.py | NasTul/models | 82,518 | 3228767 | # Copyright 2021 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 applica... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/play_ctree.py | alitrack/dtreeviz | 1,905 | 3228777 | from dtreeviz.trees import *
know = pd.read_csv("data/knowledge.csv")
class_names = ['very_low', 'Low', 'Middle', 'High']
know['UNS'] = know['UNS'].map({n: i for i, n in enumerate(class_names)})
max_depth=3
x_train = know.PEG
y_train = know['UNS']
figsize = (6,2)
fig, ax = plt.subplots(1, 1, figsize=figsize)
ct = ctr... | 0 | 0 | 0 | 0 | 0 | 0 |
shenfun/la.py | spectralDNS/shenfun | 138 | 3228836 | r"""
This module contains linear algebra solvers for SparseMatrices,
TPMatrices and BlockMatrices.
"""
import numpy as np
from numbers import Number, Integral
from scipy.sparse import spmatrix, kron
from scipy.sparse.linalg import spsolve, splu
from scipy.linalg import solve_banded
from shenfun.config import config
fro... | 0 | 0 | 0 | 0 | 0 | 1 |
django_api_forms/version.py | bumblebee211196/django_api_forms | 946 | 3228839 | <gh_stars>100-1000
__version__ = '0.19.0'
| 0 | 0 | 0 | 0 | 0 | 0 |
mindinsight/datavisual/data_access/file_handler.py | fapbatista/mindinsight | 216 | 3228850 | # Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 4 | 12 | 0 | 3 | 19 | 0 |
seagull/lifeforms/static.py | lfehertoi99/seagull | 162 | 3228858 | # -*- coding: utf-8 -*-
"""Static lifeforms do not oscillate nor move given classic Conway rules"""
# Import modules
import numpy as np
from .base import Lifeform
class Box(Lifeform):
"""A static Box"""
def __init__(self):
"""Initialize the class"""
super(Box, self).__init__()
@proper... | 0 | 6 | 0 | 0 | 6 | 0 |
examples/c2pf_example.py | carmanzhang/cornac | 597 | 3228867 | # Copyright 2018 The Cornac 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 applicable ... | 0 | 0 | 0 | 0 | 0 | 0 |
cookietemple/create/domains/pub_creator.py | e2jk/cookietemple | 117 | 3228876 | import os
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, Optional
from rich import print
from cookietemple.common.version import load_ct_template_version
from cookietemple.config.config import ConfigCommand
from cookietemple.create.domains.cookietemple_template_struct import ... | 5 | 3 | 8 | 1 | 17 | 0 |
lib/hypervisor/hv_lxc.py | modulus-sa/ganeti | 396 | 3228895 | <reponame>modulus-sa/ganeti<filename>lib/hypervisor/hv_lxc.py<gh_stars>100-1000
#
#
# Copyright (C) 2010, 2013, 2014, 2015 Google 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:
#
# 1. Red... | 0 | 0 | 0 | 0 | 0 | 0 |
sequentialRec/markovChains/sampler.py | parth-couture-ai/RecommenderSystems | 975 | 3228937 | <gh_stars>100-1000
#coding=utf-8
'''
Author: <NAME>
Contact: <EMAIL>
Reference: https://github.com/kang205/SASRec/blob/master/sampler.py
'''
# Disclaimer:
# Part of this file is derived from
# https://github.com/kang205/SASRec/
import numpy as np
from multiprocessing import Process, Queue
def random_neg(pos, n, s):... | 0 | 0 | 0 | 0 | 0 | 0 |
utime/dataset/sleep_study_dataset/sleep_study_dataset.py | learning310/U-Time | 138 | 3228939 | <filename>utime/dataset/sleep_study_dataset/sleep_study_dataset.py<gh_stars>100-1000
from utime.dataset import SleepStudy
from utime.dataset.sleep_study_dataset.subject_dir_sleep_study_dataset_base\
import SubjectDirSleepStudyDatasetBase
class SleepStudyDataset(SubjectDirSleepStudyDatasetBase):
"""
Repres... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/third_party/pluggy/docs/examples/eggsample/eggsample/hookspecs.py | meyerweb/wpt | 2,479 | 3228943 | import pluggy
hookspec = pluggy.HookspecMarker("eggsample")
@hookspec
def eggsample_add_ingredients(ingredients: tuple):
"""Have a look at the ingredients and offer your own.
:param ingredients: the ingredients, don't touch them!
:return: a list of ingredients
"""
@hookspec
def eggsample_prep_cond... | 2 | 0 | 0 | 0 | 2 | 0 |
insights/parsers/tests/test_proc_limits.py | lhuett/insights-core | 121 | 3228966 | <reponame>lhuett/insights-core
from insights.parsers.proc_limits import HttpdLimits, MysqldLimits, OvsVswitchdLimits
from insights.tests import context_wrap
from ...parsers import ParseException
import pytest
PROC_LIMITS_ERR = """
cat: /proc/1100/limits: No such file or directory
""".strip()
PROC_LIMITS = """
Limit ... | 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/common/literals.py | atitaya1412/Mayan-EDMS | 336 | 3228985 | from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import mayan
DEFAULT_COMMON_COLLAPSE_LIST_MENU_LIST_FACET = False
DEFAULT_COMMON_COLLAPSE_LIST_MENU_OBJECT = False
DEFAULT_COMMON_DISABLED_APPS = settings.COMMON_DISABLED_APPS
DEFAULT_COMMON_EXTRA_APPS = settings.COMMON_EXTRA_AP... | 0 | 0 | 0 | 0 | 0 | 0 |
test/address_test.py | screamingskulls/sofi | 402 | 3228992 | <reponame>screamingskulls/sofi
from sofi.ui import Address
def test_basic():
assert(str(Address()) == "<address></address>")
def test_text():
assert(str(Address("text")) == "<address>text</address>")
def test_custom_class_ident_style_and_attrs():
assert(str(Address("text", cl='abclass', ident='123', styl... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter03/readjson.py | VinushaVemuri/learn | 185 | 3229019 | import json
with open("data.json","r") as f:
data=json.load(f)
print(type(data))
print(data['records'][0]['name'])
| 0 | 0 | 0 | 0 | 0 | 0 |
flambe/vision/classification/model.py | ethan-asapp/flambe | 148 | 3229032 | import torch
from torch import Tensor
from typing import Optional, Tuple, Union
from flambe.nn import Module # type: ignore[attr-defined]
class ImageClassifier(Module):
"""Implements a simple image classifier.
This classifier consists of an encocder module, followed by
a fully connected output layer th... | 4 | 2 | 0 | 0 | 6 | 0 |
topik/fileio/_registry.py | ContinuumIO/topik | 104 | 3229057 | <reponame>ContinuumIO/topik
from functools import partial
from six.moves import UserDict
from topik.singleton_registry import _base_register_decorator
class InputRegistry(UserDict, object):
"""Uses Borg design pattern. Core idea is that there is a global registry for each step's
possible methods
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
dlt/util/logger.py | dmarnerides/pydlt | 236 | 3229062 | from os import path
import logging
from .paths import process
from .misc import is_tensor
class Logger(object):
"""Logs values in a csv file.
Args:
name (str): Filename without extension.
fields (list or tuple): Field names (column headers).
directory (str, optional): Directory to save... | 3 | 1 | 0 | 0 | 4 | 0 |
zerver/webhooks/errbit/view.py | TylerPham2000/zulip | 17,004 | 3229075 | from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import Us... | 5 | 3 | 0 | 0 | 8 | 0 |
greykite/tests/common/test_python_utils.py | kenzie-q/greykite | 1,503 | 3229085 | import warnings
from dataclasses import dataclass
from typing import List
import numpy as np
import pandas as pd
import pytest
import scipy
from greykite.common import constants as cst
from greykite.common.evaluation import ElementwiseEvaluationMetricEnum
from greykite.common.python_utils import apply_func_to_columns... | 2 | 3 | 1 | 0 | 6 | 0 |
pre_commit_hooks/trailing_whitespace_fixer.py | Iterable/pre-commit-hooks | 2,864 | 3229135 | import argparse
import os
from typing import Optional
from typing import Sequence
def _fix_file(
filename: str,
is_markdown: bool,
chars: Optional[bytes],
) -> bool:
with open(filename, mode='rb') as file_processed:
lines = file_processed.readlines()
newlines = [_process_line(l... | 7 | 3 | 0 | 0 | 10 | 0 |
data/transcoder_evaluation_gfg/python/SWAP_BITS_IN_A_GIVEN_NUMBER.py | mxl1n/CodeGen | 241 | 3229172 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( x , p1 , p2 , n ) -> object :
set1 = ( x >> p1 ) & ( ( 1 << n ) - 1 )
set2 = ( x >> p2 ) & ( ( 1 << n ) - 1... | 0 | 1 | 0 | 0 | 1 | 0 |
core/models/feature_extractor.py | JDAI-CV/FADA | 120 | 3229179 | from __future__ import annotations
import torch
from torch import nn
import torch.nn.functional as F
from torchvision.models._utils import IntermediateLayerGetter
from .layers import FrozenBatchNorm2d
from . import vgg, resnet
class vgg_feature_extractor(nn.Module):
def __init__(self, backbone_name, pretrained_wei... | 8 | 2 | 0 | 0 | 10 | 0 |
maths/kadanes.py | JB1959/Python | 145,614 | 3229204 | <gh_stars>1000+
"""
Kadane's algorithm to get maximum subarray sum
https://medium.com/@rsinghal757/kadanes-algorithm-dynamic-programming-how-and-why-does-it-work-3fd8849ed73d
https://en.wikipedia.org/wiki/Maximum_subarray_problem
"""
test_data: tuple = ([-2, -8, -9], [2, 8, 9], [-1, 0, 1], [0, 0], [])
def neg... | 0 | 0 | 0 | 0 | 0 | 0 |
client/labml/logger.py | elgalu/labml | 463 | 3229259 | <reponame>elgalu/labml
from typing import Union, List, Tuple, overload, Dict
from labml.internal.util.colors import StyleCode
class Style(StyleCode):
r"""
Output styles
"""
none = None
normal = 'normal'
bold = 'bold'
underline = 'underline'
light = 'light'
class Color(StyleCode):
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/parser_debugger.py | thedataflows/lnav | 4,184 | 3229290 | <reponame>thedataflows/lnav<gh_stars>1000+
#! /usr/bin/env python
# Copyright (c) 2013, <NAME>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain t... | 0 | 0 | 0 | 0 | 0 | 0 |
conan/appveyor/install.py | chi-w-ng/flatbuffers | 16,870 | 3229303 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
if os.getenv("APPVEYOR_REPO_TAG") != "true":
print("Skip step. It's not TAG")
else:
os.system("pip install conan conan-package-tools")
| 0 | 0 | 0 | 0 | 0 | 0 |
third_party/google-endpoints/google/api/control/service.py | tingshao/catapult | 2,151 | 3229307 | # Copyright 2016 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 agree... | 0 | 23 | 5 | 4 | 32 | 0 |
src/utils.py | jackokaiser/NAF-tensorflow | 215 | 3229309 | import datetime
import dateutil.tz
def get_timestamp() -> object:
now = datetime.datetime.now(dateutil.tz.tzlocal())
return now.strftime('%Y_%m_%d_%H_%M_%S')
| 0 | 1 | 0 | 0 | 1 | 0 |
tests/swindon_chat_inactivity.py | tailhook/swindon | 104 | 3229311 | import re
from unittest import mock
def assert_auth(req):
assert req.path == '/swindon/authorize_connection'
assert req.headers["Host"] == "swindon.internal"
assert req.headers['Content-Type'] == 'application/json'
assert re.match('^swindon/(\d+\.){2}\d+$', req.headers['User-Agent'])
assert 'Auth... | 0 | 0 | 0 | 0 | 0 | 0 |
components/customized_partitions/generation_tools/client_key.py | kenny5660/esp-at | 362 | 3229357 | #
# ESPRESSIF MIT License
#
# Copyright (c) 2021 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
#
# Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP32 only, in which case,
# it is free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the S... | 0 | 1 | 0 | 0 | 1 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/smallest-subtree-with-all-the-deepest-nodes.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 3229364 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/smallest-subtree-with-all-the-deepest-nodes.py<gh_stars>1000+
# Time: O(n)
# Space: O(h)
import collections
class Solution(object):
def subtreeWithAllDeepest(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
mealpy/swarm_based/NMRA.py | Alhassan20/mealpy | 162 | 3229370 | <reponame>Alhassan20/mealpy
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "<NAME>" at 14:52, 17/03/2020 %
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
io/npy_dataset.py | AlbertZhangHIT/pyflann3 | 113 | 3229408 | <reponame>AlbertZhangHIT/pyflann3<gh_stars>100-1000
#Copyright 2008-2009 <NAME> (<EMAIL>). All rights reserved.
#Copyright 2008-2009 <NAME> (<EMAIL>). All rights reserved.
#
#THE BSD LICENSE
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/python/src/cat/sdk.py | woozhijun/cat | 17,318 | 3229416 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: stdrickforce (<NAME>)
# Email: <<EMAIL>> <<EMAIL>>
# Copyright (c) 2011-2018, <NAME>. All Rights Reserved.
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed wi... | 0 | 0 | 0 | 0 | 0 | 0 |
momentumnet-main/examples/plot_memory.py | ZhuFanCheng/Thesis | 188 | 3229422 | """
==================================
Plotting memory consumptions
==================================
This example compares memory used when using a ResNet or a Momentum ResNet as a function of their depth
""" # noqa
# Authors: <NAME>, <NAME>
# License: MIT
import torch
import torch.nn as nn
from momentumnet impo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/test_scoping/test_model_export.py | stanislaw/textX | 346 | 3229429 | from __future__ import unicode_literals
import io
from os.path import dirname, abspath, join, sep
import textx.export as export
import textx.scoping.providers as scoping_providers
from textx import (metamodel_from_file, register_language,
clear_language_registrations)
def test_model_export() -> o... | 0 | 2 | 0 | 0 | 2 | 0 |
downstream/semseg/datasets/scannet.py | ut-amrl/ContrastiveSceneContexts | 135 | 3229432 | <gh_stars>100-1000
import logging
import os
import sys
from pathlib import Path
import torch
import numpy as np
from scipy import spatial
from datasets.dataset import VoxelizationDataset, DatasetPhase, str2datasetphase_type
from lib.pc_utils import read_plyfile, save_point_cloud
from lib.utils import read_txt, fast_h... | 0 | 0 | 0 | 0 | 0 | 0 |
spyder_terminal/tests/test_terminal.py | mrclary/spyder-terminal | 169 | 3229444 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
from __future__ import annotations
"""Tests for the plugin."""
# Test library imports
import os
import os.path as osp
import pytest
import requests
import sys
from flaky import flaky
from pytestqt.plug... | 0 | 11 | 0 | 0 | 11 | 0 |
cactus/bootstrap/archive.py | danielchasehooper/Cactus | 1,048 | 3229460 | <reponame>danielchasehooper/Cactus
#coding:utf-8
import os
import shutil
import tarfile
import zipfile
from six.moves import urllib
class Folder(object):
def __init__(self, from_path):
self.from_path = from_path
def extractall(self, path):
os.rmdir(path)
shutil.copytree(self.from_pat... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/TCPServer25.py | amih90/bacpypes | 240 | 3229481 | <reponame>amih90/bacpypes
#!/usr/bin/env python2.5
"""
This simple TCP server application listens for one or more client connections
and echos the incoming lines back to the client. There is no conversion from
incoming streams of content into a line or any other higher-layer concept
of a packet.
"""
import os
import... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_mixins.py | codecademy-engineering/gpiozero | 743 | 3229488 | # vim: set fileencoding=utf-8:
#
# GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
#
# Copyright (c) 2019-2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import gc
import sys
from time import sleep
from threading import Event
import pytest
from gpi... | 2 | 3 | 0 | 0 | 5 | 0 |
lib/panela/colors.py | liudonghua123/cheat.sh | 28,992 | 3229500 | import os
import json
COLORS_JSON = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'colors.json')
COLOR_TABLE = json.loads(open(COLORS_JSON, 'r').read())
VALID_COLORS = [x['hexString'] for x in COLOR_TABLE]
HEX_TO_ANSI = {x['hexString']:x['colorId'] for x in COLOR_TABLE}
def rgb_from_str(s) -> tuple[object,... | 0 | 2 | 0 | 0 | 2 | 0 |
test/info.py | Cocos-BCX/Python-Middleware | 101 | 3229510 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PythonMiddleware.graphene import Graphene
from PythonMiddleware.instance import set_shared_graphene_instance
from pprint import pprint
import time
#nodeAddress = "wss://api.cocosbcx.net"
nodeAddress = "ws://test.cocosbcx.net"
#nodeAddress = "ws... | 0 | 0 | 0 | 0 | 0 | 0 |
nngen/operator/concat.py | RyusukeYamano/nngen | 207 | 3229513 | from __future__ import annotations
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import functools
from collections import OrderedDict
import veriloggen as vg
import nngen.basic_types as bt
import nngen.util as util
class concat(bt._Operator... | 2 | 5 | 2 | 0 | 9 | 0 |
python/083 Remove Duplicates from Sorted List.py | allandproust/leetcode-share | 156 | 3229539 | <filename>python/083 Remove Duplicates from Sorted List.py
'''
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
'''
# Definition for singly-linked list.
class ListNode(object):
def __i... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.