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 |
|---|---|---|---|---|---|---|
lang/py/cookbook/v2/source/cb2_20_9_exm_1.py | ch1huizong/learning | 0 | 5300 | class Skidoo(object):
''' a mapping which claims to contain all keys, each with a value
of 23; item setting and deletion are no-ops; you can also call
an instance with arbitrary positional args, result is 23. '''
__metaclass__ = MetaInterfaceChecker
__implements__ = IMinimalMapping, ICallabl... | 2.640625 | 3 |
face2anime/nb_utils.py | davidleonfdez/face2anime | 0 | 5301 | import importlib
__all__ = ['mount_gdrive']
def mount_gdrive() -> str:
"""Mount Google Drive storage of the current Google account and return the root path.
Functionality only available in Google Colab Enviroment; otherwise, it raises a RuntimeError.
"""
if (importlib.util.find_spec("google.colab")... | 3.125 | 3 |
wasch/tests.py | waschag-tvk/pywaschedv | 1 | 5302 | <reponame>waschag-tvk/pywaschedv
import datetime
from django.utils import timezone
from django.test import TestCase
from django.contrib.auth.models import (
User,
)
from wasch.models import (
Appointment,
WashUser,
WashParameters,
# not models:
AppointmentError,
StatusRights,
)
from wasch im... | 2.171875 | 2 |
Python/problem1150.py | 1050669722/LeetCode-Answers | 0 | 5303 | from typing import List
from collections import Counter
# class Solution:
# def isMajorityElement(self, nums: List[int], target: int) -> bool:
# d = Counter(nums)
# return d[target] > len(nums)//2
# class Solution:
# def isMajorityElement(self, nums: List[int], target: int) -> bool:
# ... | 3.734375 | 4 |
day17/module.py | arcadecoffee/advent-2021 | 0 | 5304 | <reponame>arcadecoffee/advent-2021<filename>day17/module.py
"""
Advent of Code 2021 - Day 17
https://adventofcode.com/2021/day/17
"""
import re
from math import ceil, sqrt
from typing import List, Tuple
DAY = 17
FULL_INPUT_FILE = f'../inputs/day{DAY:02d}/input.full.txt'
TEST_INPUT_FILE = f'../inputs/day{DAY:02d}/inp... | 3.390625 | 3 |
src/main/python/depysible/domain/rete.py | stefano-bragaglia/DePYsible | 4 | 5305 | <reponame>stefano-bragaglia/DePYsible
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
Payload = Tuple[List['Literal'], 'Substitutions']
class Root:
def __init__(self):
self.children = set()
def notify(self, ground: 'Literal'):
for child i... | 2.71875 | 3 |
pythonbot_1.0/GameData.py | jeffreyzli/pokerbot-2017 | 1 | 5306 | import HandRankings as Hand
from deuces.deuces import Card, Evaluator
class GameData:
def __init__(self, name, opponent_name, stack_size, bb):
# match stats
self.name = name
self.opponent_name = opponent_name
self.starting_stack_size = int(stack_size)
self.num_hands = 0
... | 2.84375 | 3 |
todo/models.py | zyayoung/share-todo | 0 | 5307 | from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
class Todo(models.Model):
time_add = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=64)
detail = models.TextField(blank=True)
deadline = models.DateTimeField(blank=Tr... | 2.265625 | 2 |
examples/Tutorial/Example/app.py | DrewLazzeriKitware/trame | 0 | 5308 | import os
from trame import change, update_state
from trame.layouts import SinglePageWithDrawer
from trame.html import vtk, vuetify, widgets
from vtkmodules.vtkCommonDataModel import vtkDataObject
from vtkmodules.vtkFiltersCore import vtkContourFilter
from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader
from ... | 1.59375 | 2 |
webots_ros2_tutorials/webots_ros2_tutorials/master.py | AleBurzio11/webots_ros2 | 1 | 5309 | # Copyright 1996-2021 Soft_illusion.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 2.046875 | 2 |
dev-template/src/mysql_connect_sample.py | arrowkato/pytest-CircleiCI | 0 | 5310 | import mysql.connector
from mysql.connector import errorcode
config = {
'user': 'user',
'password': 'password',
'host': 'mysql_container',
'database': 'sample_db',
'port': '3306',
}
if __name__ == "__main__":
try:
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
... | 2.96875 | 3 |
Mundo 1/ex011.py | viniciusbonito/CeV-Python-Exercicios | 0 | 5311 | # criar um programa que pergunte as dimensões de uma parede, calcule sua área e informe quantos litros de tinta
# seriam necessários para a pintura, após perguntar o rendimento da tinta informado na lata
print('=' * 40)
print('{:^40}'.format('Assistente de pintura'))
print('=' * 40)
altura = float(input('Informe a al... | 4.03125 | 4 |
Python/Mundo 3/ex088.py | henrique-tavares/Coisas | 1 | 5312 | from random import sample
from time import sleep
jogos = list()
print('-' * 20)
print(f'{"MEGA SENA":^20}')
print('-' * 20)
while True:
n = int(input("\nQuatos jogos você quer que eu sorteie? "))
if (n > 0):
break
print('\n[ERRO] Valor fora do intervalo')
print()
print('-=' * 3, e... | 3.5 | 4 |
tests/test_utils.py | django-roles-access/master | 5 | 5313 | from importlib import import_module
from unittest import TestCase as UnitTestCase
from django.contrib.auth.models import Group
from django.core.management import BaseCommand
from django.conf import settings
from django.test import TestCase
from django.views.generic import TemplateView
try:
from unittest.mock impor... | 2.21875 | 2 |
favorite_files.py | jasondavis/FavoriteFiles | 1 | 5314 | <gh_stars>1-10
'''
Favorite Files
Licensed under MIT
Copyright (c) 2012 <NAME> <<EMAIL>>
'''
import sublime
import sublime_plugin
from os.path import join, exists, normpath
from favorites import Favorites
Favs = Favorites(join(sublime.packages_path(), 'User', 'favorite_files_list.json'))
class Refresh:
dummy_fi... | 2.46875 | 2 |
tests/list/list03.py | ktok07b6/polyphony | 83 | 5315 | <filename>tests/list/list03.py
from polyphony import testbench
def list03(x, y, z):
a = [1, 2, 3]
r0 = x
r1 = y
a[r0] = a[r1] + z
return a[r0]
@testbench
def test():
assert 4 == list03(0, 1 ,2)
assert 5 == list03(2, 1 ,3)
test()
| 2.796875 | 3 |
sc2clanman/views.py | paskausks/sc2cm | 0 | 5316 | <reponame>paskausks/sc2cm
#!/bin/env python3
from collections import Counter
from django.conf import settings
from django.contrib.auth.decorators import login_required, permission_required
from django.db import models as dm
from django.shortcuts import get_object_or_404, render
from django.views.generic.list import Ba... | 2.28125 | 2 |
manimlib/mobject/functions.py | parmentelat/manim | 1 | 5317 | <reponame>parmentelat/manim<gh_stars>1-10
from manimlib.constants import *
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.utils.config_ops import digest_config
from manimlib.utils.space_ops import get_norm
class ParametricCurve(VMobject):
CONFIG = {
"t_range": [0, 1, 0.1],
... | 2.15625 | 2 |
lib/ecsmate/ecs.py | doudoudzj/ecsmate | 0 | 5318 | <gh_stars>0
#-*- coding: utf-8 -*-
#
# Copyright (c) 2012, ECSMate development team
# All rights reserved.
#
# ECSMate is distributed under the terms of the (new) BSD License.
# The full license can be found in 'LICENSE.txt'.
"""ECS SDK
"""
import time
import hmac
import base64
import hashlib
import ur... | 2.09375 | 2 |
tacker/api/v1/resource.py | mail2nsrajesh/tacker | 0 | 5319 | <filename>tacker/api/v1/resource.py
# Copyright 2012 OpenStack Foundation.
# 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/li... | 1.984375 | 2 |
akinator/utils.py | GitHubEmploy/akinator.py | 0 | 5320 | <reponame>GitHubEmploy/akinator.py
"""
MIT License
Copyright (c) 2019 NinjaSnail1080
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
t... | 2.109375 | 2 |
ucs-python/create_ucs_sp_template.py | movinalot/ucs | 0 | 5321 | <reponame>movinalot/ucs
"""
create_ucs_sp_template.py
Purpose:
UCS Manager Create a UCS Service Profile Template
Author:
<NAME> (<EMAIL>) github: (@movinalot)
Cisco Systems, Inc.
"""
from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.mometa.ls.LsServer import LsServer
from ucsmsdk.mometa.org.OrgOrg impo... | 2.015625 | 2 |
epab/core/config.py | 132nd-etcher/epab | 2 | 5322 | <reponame>132nd-etcher/epab
# coding=utf-8
"""
Handles EPAB's config file
"""
import logging
import pathlib
import elib_config
CHANGELOG_DISABLE = elib_config.ConfigValueBool(
'changelog', 'disable', description='Disable changelog building', default=False
)
CHANGELOG_FILE_PATH = elib_config.ConfigValuePath(
... | 1.921875 | 2 |
create_flask_app.py | Creativity-Hub/create_flask_app | 2 | 5323 | <gh_stars>1-10
import os
import argparse
def check_for_pkg(pkg):
try:
exec("import " + pkg)
except:
os.system("pip3 install --user " + pkg)
def create_flask_app(app='flask_app', threading=False, wsgiserver=False, unwanted_warnings=False, logging=False, further_logging=False, site_endpoints=None, endpoints=None,... | 2.484375 | 2 |
examples/flaskr/flaskr/__init__.py | Flared/flask-sqlalchemy | 2 | 5324 | <filename>examples/flaskr/flaskr/__init__.py
import os
import click
from flask import Flask
from flask.cli import with_appcontext
from flask_sqlalchemy import SQLAlchemy
__version__ = (1, 0, 0, "dev")
db = SQLAlchemy()
def create_app(test_config=None):
"""Create and configure an instance of the Flask applicati... | 2.890625 | 3 |
simulator/cc.py | mcfx/trivm | 6 | 5325 | <gh_stars>1-10
import os, sys
fn = sys.argv[1]
if os.system('python compile.py %s __tmp.S' % fn) == 0:
os.system('python asm.py __tmp.S %s' % fn[:-2])
| 2.03125 | 2 |
ad2/Actor.py | ariadnepinheiro/Disease_Simulator | 4 | 5326 | <reponame>ariadnepinheiro/Disease_Simulator
#!/usr/bin/env python
# coding: UTF-8
#
# @package Actor
# @author <NAME>
# @date 26/08/2020
#
# Actor class, which is the base class for Disease objects.
#
##
class Actor:
# Holds the value of the next "free" id.
__ID = 0
##
# Construct a new Actor object.
... | 3.265625 | 3 |
conversions/decimal_to_binary.py | smukk9/Python | 6 | 5327 | <reponame>smukk9/Python
"""Convert a Decimal Number to a Binary Number."""
def decimal_to_binary(num: int) -> str:
"""
Convert a Integer Decimal Number to a Binary Number as str.
>>> decimal_to_binary(0)
'0b0'
>>> decimal_to_binary(2)
'0b10'
>>> decimal_to_binary(7... | 4.1875 | 4 |
src/HandNetwork.py | xausky/hand-network | 2 | 5328 | #!/usr/bin/python3
#-*- coding: utf-8 -*-
import urllib.parse
import json
import base64
import requests
import logging
class Network():
LOGIN_URL = 'http://192.168.211.101/portal/pws?t=li'
BEAT_URL = 'http://192.168.211.101/portal/page/doHeartBeat.jsp'
COMMON_HERADERS = {
'Accept-Language': 'en-US',
... | 2.578125 | 3 |
algorithms_keeper/parser/rules/use_fstring.py | Fongeme/algorithms-keeper | 50 | 5329 | import libcst as cst
import libcst.matchers as m
from fixit import CstLintRule
from fixit import InvalidTestCase as Invalid
from fixit import ValidTestCase as Valid
class UseFstringRule(CstLintRule):
MESSAGE: str = (
"As mentioned in the [Contributing Guidelines]"
+ "(https://github.com/TheAlgori... | 2.609375 | 3 |
bert_multitask_learning/model_fn.py | akashnd/bert-multitask-learning | 0 | 5330 | # AUTOGENERATED! DO NOT EDIT! File to edit: source_nbs/13_model_fn.ipynb (unless otherwise specified).
__all__ = ['variable_summaries', 'filter_loss', 'BertMultiTaskBody', 'BertMultiTaskTop', 'BertMultiTask']
# Cell
from typing import Dict, Tuple
from inspect import signature
import tensorflow as tf
import transform... | 2.328125 | 2 |
SiMon/visualization.py | Jennyx18/SiMon | 9 | 5331 | <gh_stars>1-10
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import math
from datetime import datetime
from matplotlib.colors import ListedColormap, BoundaryNorm
from matplotlib.collections import LineCollection
from matplotlib import cm
from SiMon.simulation impo... | 2.578125 | 3 |
bin/psm/oil_jet.py | ChrisBarker-NOAA/tamoc | 18 | 5332 | <reponame>ChrisBarker-NOAA/tamoc
"""
Particle Size Models: Pure Oil Jet
===================================
Use the ``TAMOC`` `particle_size_models` module to simulate a laboratory
scale pure oil jet into water. This script demonstrates the typical steps
involved in using the `particle_size_models.PureJet` object, wh... | 1.75 | 2 |
tron/Nubs/hal.py | sdss/tron | 0 | 5333 | import os.path
import tron.Misc
from tron import g, hub
from tron.Hub.Command.Encoders.ASCIICmdEncoder import ASCIICmdEncoder
from tron.Hub.Nub.SocketActorNub import SocketActorNub
from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import ASCIIReplyDecoder
name = 'hal'
def start(poller):
cfg = tron.Misc.cfg.get(g.... | 2.0625 | 2 |
tests/fixtures/defxmlschema/chapter15.py | gramm/xsdata | 0 | 5334 | <reponame>gramm/xsdata
from dataclasses import dataclass, field
from decimal import Decimal
from typing import Optional
from xsdata.models.datatype import XmlDate
@dataclass
class SizeType:
value: Optional[int] = field(
default=None,
metadata={
"required": True,
}
)
sys... | 2.546875 | 3 |
extensions/domain.py | anubhavsinha98/oppia | 1 | 5335 | <gh_stars>1-10
# coding: utf-8
#
# Copyright 2014 The Oppia 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
#... | 1.765625 | 2 |
plugins/modules/oci_database_management_object_privilege_facts.py | LaudateCorpus1/oci-ansible-collection | 0 | 5336 | <reponame>LaudateCorpus1/oci-ansible-collection
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.tx... | 1.617188 | 2 |
rbc/externals/stdio.py | guilhermeleobas/rbc | 0 | 5337 | <reponame>guilhermeleobas/rbc
"""https://en.cppreference.com/w/c/io
"""
from rbc import irutils
from llvmlite import ir
from rbc.targetinfo import TargetInfo
from numba.core import cgutils, extending
from numba.core import types as nb_types
from rbc.errors import NumbaTypeError # some errors are available for Numba >... | 2.046875 | 2 |
setup.py | clach04/discoverhue | 10 | 5338 | <gh_stars>1-10
from setuptools import setup
try:
import pypandoc
long_description = pypandoc.convert_file('README.md', 'rst', extra_args=())
except ImportError:
import codecs
long_description = codecs.open('README.md', encoding='utf-8').read()
long_description = '\n'.join(long_description.splitlines()... | 1.632813 | 2 |
utils/logmmse.py | dbonattoj/Real-Time-Voice-Cloning | 3 | 5339 | <reponame>dbonattoj/Real-Time-Voice-Cloning
# The MIT License (MIT)
#
# Copyright (c) 2015 braindead
#
# 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... | 1.875 | 2 |
lib/core/session.py | 6un9-h0-Dan/CIRTKit | 97 | 5340 | # This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import time
import datetime
from lib.common.out import *
from lib.common.objects import File
from lib.core.database import Database
from lib.core.investigation import __project__
class Session(ob... | 2.640625 | 3 |
src/simple_report/xls/document.py | glibin/simple-report | 0 | 5341 | <filename>src/simple_report/xls/document.py
#coding: utf-8
import xlrd
from simple_report.core.document_wrap import BaseDocument, SpreadsheetDocument
from simple_report.xls.workbook import Workbook
from simple_report.xls.output_options import XSL_OUTPUT_SETTINGS
class DocumentXLS(BaseDocument, SpreadsheetDoc... | 2.421875 | 2 |
tests/ut/datavisual/common/test_error_handler.py | zengchen1024/mindinsight | 0 | 5342 | # 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... | 1.851563 | 2 |
pipeline_sdk/api/build/cancel_build_pb2.py | easyopsapis/easyops-api-python | 5 | 5343 | <reponame>easyopsapis/easyops-api-python<filename>pipeline_sdk/api/build/cancel_build_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: cancel_build.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import ... | 1.5 | 2 |
src/.ipynb_checkpoints/headpose_model-checkpoint.py | geochri/Intel_Edge_AI-Computer_Pointer_controller | 0 | 5344 | <filename>src/.ipynb_checkpoints/headpose_model-checkpoint.py<gh_stars>0
'''
This is a sample class for a model. You may choose to use it as-is or make any changes to it.
This has been provided just to give you an idea of how to structure your model class.
'''
from openvino.inference_engine import IENetwork, IECore
imp... | 2.5625 | 3 |
src/minisaml/internal/constants.py | HENNGE/minisaml | 2 | 5345 | <gh_stars>1-10
NAMES_SAML2_PROTOCOL = "urn:oasis:names:tc:SAML:2.0:protocol"
NAMES_SAML2_ASSERTION = "urn:oasis:names:tc:SAML:2.0:assertion"
NAMEID_FORMAT_UNSPECIFIED = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
BINDINGS_HTTP_POST = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
DATE_TIME_FORMAT = "%Y-%m... | 1.140625 | 1 |
Contests/Snackdown19_Qualifier/CHEFPRMS.py | PK-100/Competitive_Programming | 70 | 5346 | <reponame>PK-100/Competitive_Programming
import math
def square(n):
tmp=round(math.sqrt(n))
if tmp*tmp==n:
return False
else:
return True
def semprime(n):
ch = 0
if square(n)==False:
return False
for i in range(2, int(math.sqrt(n)) + 1):
while n%i==0:
... | 3.28125 | 3 |
setup.py | arokem/afq-deep-learning | 0 | 5347 | <reponame>arokem/afq-deep-learning<filename>setup.py
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='This repository hosts some work-in-progress experiments applying deep learning to predict age using tractometry data.',
author=... | 1.070313 | 1 |
make_base_container.py | thiagodasilva/runway | 0 | 5348 | <filename>make_base_container.py
#!/usr/bin/env python3
import argparse
import os
import random
import requests
import sys
import tempfile
import uuid
from libs import colorprint
from libs.cli import run_command
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
# assume well-known lvm volume group on host
# ... | 2.34375 | 2 |
exercicios_antigos/ex_01.py | jfklima/prog_pratica | 0 | 5349 | """Criar uma função que retorne min e max de uma sequência numérica
aleatória.
Só pode usar if, comparações, recursão e funções que sejam de sua
autoria.
Se quiser usar laços também pode.
Deve informar via docstring qual é a complexidade de tempo e espaço da
sua solução
"""
from math import inf
def minimo_e_maxim... | 3.96875 | 4 |
docs/demos/theme_explorer/util.py | harisbal/dash-bootstrap-components | 1 | 5350 | import dash_bootstrap_components as dbc
import dash_html_components as html
DBC_DOCS = (
"https://dash-bootstrap-components.opensource.faculty.ai/docs/components/"
)
def make_subheading(label, link):
slug = label.replace(" ", "")
heading = html.H2(
html.Span(
[
label,... | 2.46875 | 2 |
pytorch_toolbox/visualization/visdom_logger.py | MathGaron/pytorch_toolbox | 10 | 5351 | <reponame>MathGaron/pytorch_toolbox
'''
The visualization class provides an easy access to some of the visdom functionalities
Accept as input a number that will be ploted over time or an image of type np.ndarray
'''
from visdom import Visdom
import numpy as np
import numbers
class VisdomLogger:
items_iterator = ... | 3.28125 | 3 |
analytical/conditionnumber.py | gyyang/olfaction_evolution | 9 | 5352 | <filename>analytical/conditionnumber.py
"""Analyze condition number of the network."""
import numpy as np
import matplotlib.pyplot as plt
# import model
def _get_sparse_mask(nx, ny, non, complex=False, nOR=50):
"""Generate a binary mask.
The mask will be of size (nx, ny)
For all the nx connections to ea... | 2.609375 | 3 |
FusionIIIT/applications/placement_cell/api/serializers.py | 29rj/Fusion | 29 | 5353 | <reponame>29rj/Fusion
from rest_framework.authtoken.models import Token
from rest_framework import serializers
from applications.placement_cell.models import (Achievement, Course, Education,
Experience, Has, Patent,
Project... | 2.171875 | 2 |
concat_col_app/factories.py | thinkAmi-sandbox/django-datatables-view-sample | 0 | 5354 | <filename>concat_col_app/factories.py
import factory
from concat_col_app.models import Color, Apple
class ColorFactory(factory.django.DjangoModelFactory):
class Meta:
model = Color
class AppleFactory(factory.django.DjangoModelFactory):
class Meta:
model = Apple
| 1.867188 | 2 |
defects4cpp/errors/argparser.py | HansolChoe/defects4cpp | 10 | 5355 | from pathlib import Path
from typing import Dict
from errors.common.exception import DppError
class DppArgparseError(DppError):
pass
class DppArgparseTaxonomyNotFoundError(DppArgparseError):
def __init__(self, taxonomy_name: str):
super().__init__(f"taxonomy '{taxonomy_name}' does not exist")
... | 2.546875 | 3 |
utils/__init__.py | wang97zh/EVS-Net-1 | 0 | 5356 |
from .utility import *
from .tricks import *
from .tensorlog import *
from .self_op import *
from .resume import *
from .optims import *
from .metric import *
| 0.972656 | 1 |
model-optimizer/extensions/front/mxnet/arange_ext.py | calvinfeng/openvino | 0 | 5357 | """
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | 1.765625 | 2 |
fold_cur_trans.py | lucasforever24/arcface_noonan | 0 | 5358 | import cv2
from PIL import Image
import argparse
from pathlib import Path
from multiprocessing import Process, Pipe,Value,Array
import torch
from config import get_config
from mtcnn import MTCNN
from Learner_trans_tf import face_learner
from utils import load_facebank, draw_box_name, prepare_facebank, save_label_score,... | 2.078125 | 2 |
examples/tryclass.py | manahter/dirio | 0 | 5359 | <gh_stars>0
import time
class TryClass:
value = 1
valu = 2
val = 3
va = 4
v = 5
def __init__(self, value=4):
print("Created TryClass :", self)
self.value = value
def metod1(self, value, val2=""):
self.value += value
print(f"\t>>> metod 1, add: {value}, now... | 3.125 | 3 |
qiskit/providers/basebackend.py | ismaila-at-za-ibm/qiskit-terra | 2 | 5360 | <reponame>ismaila-at-za-ibm/qiskit-terra<filename>qiskit/providers/basebackend.py
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""This module implements the abstract base... | 2.25 | 2 |
arrays/jump2/Solution.py | shahbagdadi/py-algo-n-ds | 0 | 5361 | from typing import List
import sys
class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) <=1: return 0
l , r , jumps = 0, nums[0] , 1
while r < len(nums)-1 :
jumps += 1
# you can land anywhere between l & r+1 in a jump and then use Num[i] to jump from ... | 3.59375 | 4 |
share/tests.py | shared-tw/shared-tw | 2 | 5362 | import unittest
from . import states
class DonationStateTestCase(unittest.TestCase):
def test_approve_pending_state(self):
approve_pending_statue = states.PendingApprovalState()
approved_event = states.DonationApprovedEvent()
self.assertIsInstance(
approve_pending_statue.appl... | 2.65625 | 3 |
app/extensions.py | grow/airpress | 1 | 5363 | from jinja2 import nodes
from jinja2.ext import Extension
class FragmentCacheExtension(Extension):
# a set of names that trigger the extension.
tags = set(['cache'])
def __init__(self, environment):
super(FragmentCacheExtension, self).__init__(environment)
# add the defaults to the envir... | 2.703125 | 3 |
modtox/Helpers/helpers.py | danielSoler93/modtox | 4 | 5364 | <gh_stars>1-10
import os
def retrieve_molecule_number(pdb, resname):
"""
IDENTIFICATION OF MOLECULE NUMBER BASED
ON THE TER'S
"""
count = 0
with open(pdb, 'r') as x:
lines = x.readlines()
for i in lines:
if i.split()[0] == 'TER': count += 1
if i.split()[3]... | 2.65625 | 3 |
bbio/platform/beaglebone/api.py | efargas/PyBBIO | 0 | 5365 | # api.py
# Part of PyBBIO
# github.com/alexanderhiam/PyBBIO
# MIT License
#
# Beaglebone platform API file.
from bbio.platform.platform import detect_platform
PLATFORM = detect_platform()
if "3.8" in PLATFORM:
from bone_3_8.adc import analog_init, analog_cleanup
from bone_3_8.pwm import pwm_init, pwm_cleanup
... | 2.21875 | 2 |
tryhackme/http.py | GnarLito/tryhackme.py | 0 | 5366 | import re
import sys
from urllib.parse import quote as _uriquote
import requests
from . import __version__, errors, utils
from .converters import _county_types, _leaderboard_types, _vpn_types, _not_none
from . import checks
from .cog import request_cog
GET='get'
POST='post'
class HTTPClient:
__CSRF_token_regex... | 2.296875 | 2 |
flatlander/runner/experiment_runner.py | wullli/flatlander | 3 | 5367 | <reponame>wullli/flatlander<gh_stars>1-10
import os
from argparse import ArgumentParser
from pathlib import Path
import gym
import ray
import ray.tune.result as ray_results
import yaml
from gym.spaces import Tuple
from ray.cluster_utils import Cluster
from ray.rllib.utils import try_import_tf, try_import_torch
from ra... | 1.945313 | 2 |
syslib/utils_keywords.py | rahulmah/sample-cloud-native-toolchain-tutorial-20170720084529291 | 1 | 5368 | <filename>syslib/utils_keywords.py<gh_stars>1-10
#!/usr/bin/env python
r"""
This module contains keyword functions to supplement robot's built in
functions and use in test where generic robot keywords don't support.
"""
import time
from robot.libraries.BuiltIn import BuiltIn
from robot.libraries import DateTime
impor... | 2.828125 | 3 |
tools/webcam/webcam_apis/nodes/__init__.py | ivmtorres/mmpose | 1 | 5369 | # Copyright (c) OpenMMLab. All rights reserved.
from .builder import NODES
from .faceswap_nodes import FaceSwapNode
from .frame_effect_nodes import (BackgroundNode, BugEyeNode, MoustacheNode,
NoticeBoardNode, PoseVisualizerNode,
SaiyanNode, SunglassesNod... | 1.265625 | 1 |
DBParser/DBMove.py | lelle1234/Db2Utils | 4 | 5370 | <gh_stars>1-10
#!/usr/bin/python3
import ibm_db
import getopt
import sys
import os
from toposort import toposort_flatten
db = None
host = "localhost"
port = "50000"
user = None
pwd = None
outfile = None
targetdb = None
try:
opts, args = getopt.getopt(sys.argv[1:], "h:d:P:u:p:o:t:")
except getopt.GetoptError:
... | 2.25 | 2 |
utils/glove.py | MirunaPislar/Word2vec | 13 | 5371 | import numpy as np
DEFAULT_FILE_PATH = "utils/datasets/glove.6B.50d.txt"
def loadWordVectors(tokens, filepath=DEFAULT_FILE_PATH, dimensions=50):
"""Read pretrained GloVe vectors"""
wordVectors = np.zeros((len(tokens), dimensions))
with open(filepath) as ifs:
for line in ifs:
line = lin... | 2.921875 | 3 |
composer/profiler/__init__.py | stanford-crfm/composer | 0 | 5372 | <gh_stars>0
# Copyright 2021 MosaicML. All Rights Reserved.
"""Performance profiling tools.
The profiler gathers performance metrics during a training run that can be used to diagnose bottlenecks and
facilitate model development.
The metrics gathered include:
* Duration of each :class:`.Event` during training
* Tim... | 2.4375 | 2 |
gremlin-python/src/main/jython/setup.py | EvKissle/tinkerpop | 0 | 5373 | <reponame>EvKissle/tinkerpop<gh_stars>0
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.... | 1.46875 | 1 |
src/_bar.py | yoshihikosuzuki/plotly_light | 0 | 5374 | <reponame>yoshihikosuzuki/plotly_light<gh_stars>0
from typing import Optional, Sequence
import plotly.graph_objects as go
def bar(x: Sequence,
y: Sequence,
text: Optional[Sequence] = None,
width: Optional[int] = None,
col: Optional[str] = None,
opacity: float = 1,
name: ... | 3.21875 | 3 |
pennylane/templates/subroutines/arbitrary_unitary.py | doomhammerhell/pennylane | 3 | 5375 | <reponame>doomhammerhell/pennylane
# Copyright 2018-2021 Xanadu Quantum Technologies 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
# U... | 2.90625 | 3 |
vae_celeba.py | aidiary/generative-models-pytorch | 0 | 5376 | <reponame>aidiary/generative-models-pytorch
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from pytorch_lightning.loggers import TensorBoardLogger
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.da... | 2.421875 | 2 |
data/process_data.py | julat/DisasterResponse | 0 | 5377 | <reponame>julat/DisasterResponse
# Import libraries
import sys
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
"""
Load the data from the disaster response csvs
Parameters:
messages_filepath (str): Path to messages csv
categories_filepa... | 3.09375 | 3 |
contrail-controller/files/plugins/check_contrail_status_controller.py | atsgen/tf-charms | 0 | 5378 | #!/usr/bin/env python3
import subprocess
import sys
import json
SERVICES = {
'control': [
'control',
'nodemgr',
'named',
'dns',
],
'config-database': [
'nodemgr',
'zookeeper',
'rabbitmq',
'cassandra',
],
'webui': [
'web',
... | 2.53125 | 3 |
leaderboard-server/leaderboard-server.py | harnitsignalfx/skogaming | 1 | 5379 | <filename>leaderboard-server/leaderboard-server.py
from flask import Flask, jsonify, request
from flask_cors import CORS, cross_origin
import simplejson as json
from leaderboard.leaderboard import Leaderboard
import uwsgidecorators
import signalfx
app = Flask(__name__)
app.config['CORS_HEADERS'] = 'Content-Type'
cors... | 2.6875 | 3 |
meshio/_cli/_info.py | jorgensd/meshio | 1 | 5380 | import argparse
import numpy as np
from .._helpers import read, reader_map
from ._helpers import _get_version_text
def info(argv=None):
# Parse command line arguments.
parser = _get_info_parser()
args = parser.parse_args(argv)
# read mesh data
mesh = read(args.infile, file_format=args.input_for... | 2.84375 | 3 |
ccslink/Zip.py | Data-Linkage/ccslink | 0 | 5381 | <reponame>Data-Linkage/ccslink<gh_stars>0
import os, shutil
from CCSLink import Spark_Session as SS
def add_zipped_dependency(zip_from, zip_target):
"""
This method creates a zip of the code to be sent to the executors.
It essentially zips the Python packages installed by PIP and
submits them via addPy... | 2.640625 | 3 |
moltemplate/nbody_Angles.py | Mopolino8/moltemplate | 0 | 5382 | <reponame>Mopolino8/moltemplate<filename>moltemplate/nbody_Angles.py
try:
from .nbody_graph_search import Ugraph
except (SystemError, ValueError):
# not installed as a package
from nbody_graph_search import Ugraph
# This file defines how 3-body angle interactions are generated by moltemplate
# by default.... | 2.5 | 2 |
extras/usd/examples/usdMakeFileVariantModelAsset/usdMakeFileVariantModelAsset.py | DougRogers-DigitalFish/USD | 3,680 | 5383 | #!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | 1.664063 | 2 |
src/main.py | fbdp1202/pyukf_kinect_body_tracking | 7 | 5384 | <gh_stars>1-10
import sys
import os
sys.path.append('./code/')
from skeleton import Skeleton
from read_data import *
from calibration import Calibration
from ukf_filter import ukf_Filter_Controler
from canvas import Canvas
from regression import *
import time
from functools import wraps
import os
def check_time(fun... | 2.15625 | 2 |
cfgov/scripts/initial_data.py | Mario-Kart-Felix/cfgov-refresh | 1 | 5385 | from __future__ import print_function
import json
import os
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from wagtail.wagtailcore.models import Page, Site
from v1.models import HomePage, BrowseFilterablePage
def run():
print(... | 1.9375 | 2 |
Scripts/compareOutputs.py | harmim/vut-avs-project1 | 0 | 5386 | <filename>Scripts/compareOutputs.py<gh_stars>0
# Simple python3 script to compare output with a reference output.
# Usage: python3 compareOutputs.py testOutput.h5 testRefOutput.h5
import sys
import h5py
import numpy as np
if len(sys.argv) != 3:
print("Expected two arguments. Output and reference output file.")
... | 3.140625 | 3 |
sanctuary/tag/serializers.py | 20CM/Sanctuary | 1 | 5387 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from rest_framework import serializers
from .models import Tag
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tag
read_only_fields = ('topics_count',)
| 1.546875 | 2 |
examples/management_api/aliveness_test.py | cloudamqp/amqpstorm | 0 | 5388 | <gh_stars>0
from amqpstorm.management import ApiConnectionError
from amqpstorm.management import ApiError
from amqpstorm.management import ManagementApi
if __name__ == '__main__':
API = ManagementApi('http://127.0.0.1:15672', 'guest', 'guest')
try:
result = API.aliveness_test('/')
if result['st... | 2.671875 | 3 |
src/zvt/recorders/em/meta/em_stockhk_meta_recorder.py | vishalbelsare/zvt | 2,032 | 5389 | # -*- coding: utf-8 -*-
from zvt.contract.api import df_to_db
from zvt.contract.recorder import Recorder
from zvt.domain.meta.stockhk_meta import Stockhk
from zvt.recorders.em import em_api
class EMStockhkRecorder(Recorder):
provider = "em"
data_schema = Stockhk
def run(self):
df_south = em_api.... | 1.9375 | 2 |
src/main.py | yanwunhao/auto-mshts | 0 | 5390 | <reponame>yanwunhao/auto-mshts
from util.io import read_setting_json, read_0h_data, read_24h_data, draw_single_curve
from util.convert import split_array_into_samples, calculate_avg_of_sample, convert_to_percentage
from util.calculus import calculate_summary_of_sample, fit_sigmoid_curve
import matplotlib.pyplot as plt... | 2.6875 | 3 |
twisted/names/root.py | twonds/twisted | 1 | 5391 | # -*- test-case-name: twisted.names.test.test_rootresolve -*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Resolver implementation for querying successive authoritative servers to
lookup a record, starting from the root nameservers.
@author: <NAME>
todo::
robustify it
... | 2.59375 | 3 |
tools/apply_colormap_dir.py | edwardyehuang/iDS | 0 | 5392 | # ================================================================
# MIT License
# Copyright (c) 2021 edwardyehuang (https://github.com/edwardyehuang)
# ================================================================
import os, sys
rootpath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pard... | 2.125 | 2 |
kairon/shared/sso/base.py | rit1200/kairon | 9 | 5393 | <reponame>rit1200/kairon<gh_stars>1-10
class BaseSSO:
async def get_redirect_url(self):
"""Returns redirect url for facebook."""
raise NotImplementedError("Provider not implemented")
async def verify(self, request):
"""
Fetches user details using code received in the request.... | 2.265625 | 2 |
EDScoutCore/JournalInterface.py | bal6765/ed-scout | 0 | 5394 | <gh_stars>0
from inspect import signature
import json
import time
import os
import glob
import logging
from pathlib import Path
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
from watchdog.events import PatternMatchingEventHandler
from EDScoutCore.FileSystemUp... | 2.234375 | 2 |
labs-python/lab9/add_files.py | xR86/ml-stuff | 3 | 5395 | import sqlite3
conn = sqlite3.connect('example.db')
c = conn.cursor()
import os
import hashlib
import time
def get_file_md5(filePath):
h = hashlib.md5()
h.update(open(filePath,"rb").read())
return h.hexdigest()
def get_file_sha256(filePath):
h = hashlib.sha256()
h.update(open(filePath,"rb").read())
return h.... | 2.84375 | 3 |
lib/galaxy/model/migrate/versions/0073_add_ldda_to_implicit_conversion_table.py | blankenberg/galaxy-data-resource | 0 | 5396 | """
Migration script to add 'ldda_parent_id' column to the implicitly_converted_dataset_association table.
"""
from sqlalchemy import *
from sqlalchemy.orm import *
from migrate import *
from migrate.changeset import *
import logging
log = logging.getLogger( __name__ )
metadata = MetaData()
def upgrade(migrate_engi... | 2.25 | 2 |
Replication Python and R Codes/Figure_6/cMCA_ESS2018_LABCON_org.py | tzuliu/Contrastive-Multiple-Correspondence-Analysis-cMCA | 3 | 5397 | <reponame>tzuliu/Contrastive-Multiple-Correspondence-Analysis-cMCA<filename>Replication Python and R Codes/Figure_6/cMCA_ESS2018_LABCON_org.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import prince
from sklearn import utils
from sklearn.cluster import DBSCAN
import itertools
from cmca impo... | 1.929688 | 2 |
Solutions/077.py | ruppysuppy/Daily-Coding-Problem-Solutions | 70 | 5398 | <gh_stars>10-100
"""
Problem:
Given a list of possibly overlapping intervals, return a new list of intervals where
all overlapping intervals have been merged.
The input list is not necessarily ordered in any way.
For example, given [(1, 3), (5, 8), (4, 10), (20, 25)], you should return
[(1, 3), (4, 10), (20, 25)].
"... | 3.875 | 4 |
slackbot_wems/chris/slacklib.py | wray/wems | 4 | 5399 | <reponame>wray/wems<filename>slackbot_wems/chris/slacklib.py<gh_stars>1-10
import time
import emoji
# Put your commands here
COMMAND1 = "testing testing"
COMMAND2 = "roger roger"
BLUEON = str("blue on")
BLUEOFF = str("blue off")
REDON = str("red on")
REDOFF = str("red off")
GREENON = str("green on")
GREENOFF = str(... | 3.015625 | 3 |