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 |
|---|---|---|---|---|---|---|
e_vae_proj/qualitative/gen_jobs.py | kuangdai/disentangling-vae | 1 | 27500 | import numpy as np
from pathlib import Path
import sys, os
if __name__ == "__main__":
"""
Jobs:
1) VAE (VAE loss) for data=[dsprites, celeba, chairs]
2) VAE (beta-TC loss with alpha=beta=gamma=1) for data=[dsprites, celeba, chairs]
3) beta-TCVAE for alpha=gamma=[0.5, 1, 2], for beta=[3,6],... | 1.789063 | 2 |
iktomi/forms/widgets.py | boltnev/iktomi | 14 | 27501 | # -*- coding: utf-8 -*-
from ..utils import weakproxy
from . import convs
class Widget(object):
# obsolete parameters from previous versions
_obsolete = frozenset(['multiple'])
#: Template to render widget
template = None
#: Value of HTML element's *class* attribute
classname = ''
#: de... | 2.203125 | 2 |
Codes/python/py1/exs (4)/ex10.py | Gaazedo/portfolio | 0 | 27502 | <reponame>Gaazedo/portfolio<filename>Codes/python/py1/exs (4)/ex10.py
from ex3 import cont, intersec
from ex4 import iguais
from ex5 import iguais1
from ex6 import conta, lervetor
from ex7 import achar, ler_vetorx
from utility import ler_vetor
def menuprinc():
opcao = int(
input('''
Escolha um programa:
1... | 2.890625 | 3 |
warehouse.py | Arthraim/warehouse | 1 | 27503 | __author__ = 'arthur'
from PyQt5.QtCore import *
from models import *
class WareHouse(QObject):
def __init__(self):
super(QObject, self).__init__()
@pyqtSlot(result=QVariant)
def all_cargo(self):
return QVariant(map(lambda x: x.javascriptify(), Cargo.select())) | 2.390625 | 2 |
yadil/image/face_model.py | neolaw84/yadil | 0 | 27504 | # downloaded from https://raw.githubusercontent.com/TadasBaltrusaitis/OpenFace/master/lib/local/LandmarkDetector/model/pdms/In-the-wild_aligned_PDM_68.txt
import pickle
import pathlib
THIS_FILE_PATH = pathlib.Path(__file__)
MODEL_FILE_PATH = pathlib.Path.joinpath(THIS_FILE_PATH.parent, "face_model.bin")
with... | 2.21875 | 2 |
Backend/scripts/average_block_rate.py | zarif007/Block-Chain-Web-App | 1 | 27505 | <gh_stars>1-10
import time
from backend.blockchain.Blockchain import Blockchain
from backend.config import SECONDS
blockchain = Blockchain()
times = []
for i in range(1000):
start_time = time.time_ns()
blockchain.add_block(i)
end_time = time.time_ns()
time_to_mine = (end_time - start_time) / SECOND... | 2.8125 | 3 |
python/tdapi/td_oauth.py | chaelim/ExcelRTD | 5 | 27506 | from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import logging
import datetime
import json
import os
import pickle
import requests
import time
import win32crypt
from typing import Dict
from typing import List
if __package__:
f... | 2.890625 | 3 |
visitpy/visit_utils/tests/test_qannote_basic.py | ahota/visit_ospray | 0 | 27507 | #*****************************************************************************
#
# Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
# Produced at the Lawrence Livermore National Laboratory
# LLNL-CODE-442911
# All rights reserved.
#
# This file is part of VisIt. For details, see https://visit.llnl... | 0.851563 | 1 |
searchengine.py | ayser259/searchengine | 0 | 27508 | # This program runs the search engine program
import ast,sys,os,json, time, re,math
from objects import *
import lexicon_engine as lexicon_engine
from snippet_engine import *
def bm25_top_10(doc_no_to_internal_id,internal_id_to_metadata,inverted_index,tokens_to_id):
# Retrieving Query from user
print()
que... | 2.8125 | 3 |
dedup_parellel.py | darrenkoh/File-Dedupe | 0 | 27509 | <gh_stars>0
# Given a folder, scan all files and group file with same content
import sys
import os
import shutil
import hashlib
import time
from collections import defaultdict
import multiprocessing
from functools import partial
import time
def ExtractFingerprint(filename, bit):
size = os.path.getsize(filename)
... | 2.765625 | 3 |
snorkel/learning/structure/synthetic.py | Conengmo/snorkel | 30 | 27510 | <filename>snorkel/learning/structure/synthetic.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
from numbskull import NumbSkull
from numbskull.inference import FACTORS
from numbskull.numbskullt... | 2.140625 | 2 |
onaws/__init__.py | bbhunter/onaws | 1 | 27511 | <reponame>bbhunter/onaws
'''Simple library to check if a hostname belongs to AWS IP space.'''
__version__ = '0.0.12'
| 1.132813 | 1 |
tests/interactive/nb-test.py | andrey-puzyr/docker-dotnet-spark | 18 | 27512 | <reponame>andrey-puzyr/docker-dotnet-spark<filename>tests/interactive/nb-test.py
import sys
import argparse
import re
import subprocess
import nbformat
from pathlib import Path
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.preprocessors import CellExecutionError
parser = argparse.ArgumentParse... | 2.140625 | 2 |
scripts/ersst_everything.py | khandokershanto/climate_data_analysis_with_python | 0 | 27513 | import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import geocat.viz.util as gvutil
path = r'H:\Python project 2021\climate_data_analysis_with_python\data\sst.mnmean.nc'
ds= xr.open_dataset(path)
# time slicing
sst = ds.sst.sel(time=slice('1920-01-01','2020-12-01'))
# anomaly wi... | 2.734375 | 3 |
scripts/Model Training.py | Nickroll/League-Feature-Importance | 0 | 27514 | <reponame>Nickroll/League-Feature-Importance
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
from sklearn.ensemble import BaggingClassifier, ExtraTreesClassifier
from sklearn.ensemble import GradientBoostingClassifier, VotingClassifier
from sklearn.tree imp... | 2.609375 | 3 |
src/SimulationControl/SpheralConservation.py | jmikeowen/Spheral | 22 | 27515 | # SpheralConservation
import mpi
from SpheralCompiledPackages import *
#-------------------------------------------------------------------------------
# Conservation
#-------------------------------------------------------------------------------
class SpheralConservation:
#--------------------------------------... | 2.21875 | 2 |
ro_py/economy.py | jmkd3v/ro.py | 0 | 27516 | <filename>ro_py/economy.py<gh_stars>0
"""
This file houses functions and classes that pertain to the Roblox economy endpoints.
"""
from ro_py.utilities.url import url
endpoint = url("economy")
class Currency:
"""
Represents currency data.
"""
def __init__(self, currency_data):
self.robux = ... | 2.78125 | 3 |
ask/qa/forms.py | kzn-bulat-s/abracadabra | 0 | 27517 | from django import forms
from django.contrib.auth.models import User
from models import Question, Answer
class AskForm(forms.ModelForm):
class Meta:
model = Question
fields = ['title', 'text']
def save(self, commit=True):
question = super(AskForm, self).save(commit=False)
que... | 2.765625 | 3 |
tests/pow_tests.py | pythononwheels/coronadash | 0 | 27518 | #
# Pow Default Tests
#
#
# runtest script.
# runs test with respect to some paramters
# currently only os
import sys
import pytest
# possible sys.platform results:
# http://stackoverflow.com/questions/446209/possible-values-from-sys-platform
MODELNAME = "pow_test_model"
class TestClass:
@pytest.mark.notonosx
... | 2.25 | 2 |
codility/python/fib.py | guvkon/aoc-2021 | 0 | 27519 | <filename>codility/python/fib.py<gh_stars>0
import math
def fib(n):
fib = [0] * (n + 1)
fib[1] = 1
for i in range(2, n + 1):
fib[i] = fib[i - 1] + fib[i - 2]
return fib[n]
def fib_formula(n):
return int((math.pow((1 + math.sqrt(5)) / 2, n) - math.pow((1 - math.sqrt(5)) / 2, n)) / math.sqrt... | 3.75 | 4 |
src/pengbot/adapters/facebook/adapter.py | mariocesar/pengbot | 1 | 27520 | <reponame>mariocesar/pengbot<filename>src/pengbot/adapters/facebook/adapter.py
import json
from pengbot.utils import isbound
from .api import Facebook
from ..web import WebAdapter
class Adapter(WebAdapter):
_fbapi = None
@property
def fbapi(self):
if not self._fbapi:
self._fbapi = F... | 2.375 | 2 |
tests/test_policy_loading.py | alancinacio/advanced-security-compliance | 83 | 27521 | <reponame>alancinacio/advanced-security-compliance
import os
import sys
import yaml
import uuid
import unittest
import tempfile
sys.path.append(".")
from ghascompliance.policy import Policy
class TestPolicyLoading(unittest.TestCase):
def setUp(self):
self.policy_file = self.genTempFile()
return ... | 2.4375 | 2 |
python/se3last-w3c/conftest.py | saucelabs-training/platform-config-tests | 1 | 27522 | <filename>python/se3last-w3c/conftest.py
import os
import sys
import time
import pytest
from appium import webdriver as appiumdriver
from selenium import webdriver
class Helpers:
@staticmethod
def validate_google(driver):
driver.get("http://google.com")
time.sleep(1)
result = 'passed... | 2.421875 | 2 |
PharmacoDI/write_pset_table.py | bhklab/PharmacoDI | 0 | 27523 | import os
from datatable import dt, as_type
# -- Enable logging
from loguru import logger
import sys
logger_config = {
"handlers": [
{"sink": sys.stdout, "colorize": True, "format":
"<green>{time}</green> <level>{message}</level>"},
{"sink": f"logs/write_pset_tables.log",
"... | 2.296875 | 2 |
timemachines/skaters/orbt/orbitlgtskaterfactory.py | iklasky/timemachines | 253 | 27524 |
from timemachines.skaters.orbt.orbitinclusion import using_orbit
if using_orbit:
from timemachines.skaters.orbt.orbitwrappers import orbit_lgt_iskater
from timemachines.skatertools.utilities.conventions import Y_TYPE, A_TYPE, R_TYPE, E_TYPE, T_TYPE
from timemachines.skatertools.batch.batchskater import ba... | 2.078125 | 2 |
script/en_glue/preprocess/qnli.py | kunde122/ERNIE1 | 1 | 27525 | import sys
mapping = {'entailment': 1, 'not_entailment': 0}
i = 0
for line in sys.stdin:
arr = line.strip().split('\t')
s1 = arr[1]
s2 = arr[2]
if len(arr) == 4:
if i == 0:
i += 1
print('text_a\ttext_b\tlabel')
continue
s3 = arr[3]
print("{}\... | 2.890625 | 3 |
gsee/__init__.py | scene-connect/gsee | 0 | 27526 | __all__ = ["brl_model", "pv"]
from gsee import brl_model, pv
| 1.046875 | 1 |
src/data_standardization/tests/test_boston_volume.py | nsteins/crash-model | 54 | 27527 | <filename>src/data_standardization/tests/test_boston_volume.py
from ..boston_volume import BostonVolumeParser
import os
def test_is_readable_ATR():
parser = BostonVolumeParser(os.path.abspath(__file__))
bad = '7147_NA_NA_53_CLAPP-ST_DORCHESTER_24-HOURS_SPEED_02-25-2013.XLS'
assert not parser.is_readable... | 2.53125 | 3 |
custom_components/luxtronik/binary_sensor.py | WhistleMaster/luxtronik | 37 | 27528 | """Support for Luxtronik heatpump binary states."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_FRIENDLY_NAME, CONF_ICON, CONF_ID, CONF_SENSORS
import homeassistant.helpers.config_validation as cv
f... | 2.015625 | 2 |
Algorithms_easy/1065. Index Pairs of a String.py | VinceW0/Leetcode_Python_solutions | 4 | 27529 | <reponame>VinceW0/Leetcode_Python_solutions
"""
1065. Index Pairs of a String
Easy
Given a text string and words (a list of strings), return all index pairs [i, j] so that the substring text[i]...text[j] is in the list of words.
Example 1:
Input: text = "thestoryofleetcodeandme", words = ["story","fleet","leetcode"]... | 3.921875 | 4 |
setup.py | jsdnlb/Tangelo-challenge | 0 | 27530 | from setuptools import setup, find_packages
# Building and Distributing Packages with Setuptools
# Documentation here: https://setuptools.pypa.io/en/latest/setuptools.html
setup(name='app', version='1.0', packages=find_packages())
| 1.242188 | 1 |
sponsors/migrations/0038_auto_20210827_1223.py | Manny27nyc/pythondotorg | 911 | 27531 | # Generated by Django 2.0.13 on 2021-08-27 12:23
from django.db import migrations
def populate_sponsorship_package_fk(apps, schema_editor):
Sponsorship = apps.get_model('sponsors.Sponsorship')
SponsorshipPackage = apps.get_model('sponsors.SponsorshipPackage')
for sponsorship in Sponsorship.objects.all()... | 1.945313 | 2 |
fugue_sql/workflow.py | LaurentErreca/fugue | 0 | 27532 | from builtins import isinstance
from typing import Any, Dict, Tuple
from fugue import (
DataFrame,
FugueWorkflow,
WorkflowDataFrame,
WorkflowDataFrames,
Yielded,
)
from fugue.constants import FUGUE_CONF_SQL_IGNORE_CASE
from fugue.workflow import is_acceptable_raw_df
from fugue_sql._parse import Fug... | 2.234375 | 2 |
project/WeiboTest/SpiderMain.py | zhengbomo/python_practice | 2 | 27533 | #!/usr/bin/python
# -*- coding:utf-8 -*-
from Spider import Spider
# 入口
spider = Spider()
fans = spider.get_my_fans()
for fan in fans:
spider.user_crawl(fan.user_id)
spider.status_crawl(fan.user_id)
followers = spider.get_my_follower()
for follower in followers:
spider.user_crawl(fan.user_id)
spider... | 2.859375 | 3 |
setup.py | konstanzer/insilico | 1 | 27534 | <reponame>konstanzer/insilico
from setuptools import setup
long_description = open("README.md").read()
setup(
name='insilico',
version='0.1.2',
description='A Python package to process & model ChEMBL data.',
long_description_content_type="text/markdown",
long_description=long_description,
clas... | 1.5 | 2 |
home/board/migrations/0004_add_closed_at.py | he0119/smart-home | 0 | 27535 | <reponame>he0119/smart-home<filename>home/board/migrations/0004_add_closed_at.py
# Generated by Django 3.1.4 on 2020-12-25 02:53
from django.db import migrations, models
def set_edited_at(apps, schema_editor):
"""修改话题的时间
将关闭话题的修改时间设置成创建时间
将其关闭时间设置成其修改时间
将置顶话题的修改时间设置成创建时间
"""
Topic = apps.get... | 2.046875 | 2 |
week_5/Service.py | aaaaaaaalesha/oop-and-design-patterns | 0 | 27536 | import pygame
import random
import yaml
import os
import Objects
OBJECT_TEXTURE = os.path.join("texture", "objects")
ENEMY_TEXTURE = os.path.join("texture", "enemies")
ALLY_TEXTURE = os.path.join("texture", "ally")
def create_sprite(img, sprite_size, mmp_tile):
icon = pygame.image.load(img).convert_a... | 2.890625 | 3 |
test/test_search.py | tomkralidis/sat-search | 0 | 27537 | import os
import glob
import json
import unittest
import satsearch.config as config
from satstac import Item
from satsearch.search import SatSearchError, Search
class Test(unittest.TestCase):
path = os.path.dirname(__file__)
results = []
@classmethod
def setUpClass(cls):
fnames = glob.glob... | 2.875 | 3 |
src/lck/django/common/forms.py | ar4s/kitdjango | 10 | 27538 | <filename>src/lck/django/common/forms.py
"""
Albeit useful, this module is still somewhat a mess in a really early state of development. Beware, there be dragons.
"""
import datetime
import os
import re
from subprocess import check_call, CalledProcessError
from tempfile import NamedTemporaryFile
try:
from cString... | 2.09375 | 2 |
utils/model_utils.py | Pandinosaurus/PerceptualImageError | 0 | 27539 | import tensorflow as tf
def extract_image_patches(image_batch, patch_size,patch_stride):
patches = tf.extract_image_patches(images =image_batch,ksizes=[1,patch_size,patch_size,1],rates=[1,1,1,1],strides=[1,patch_stride,patch_stride,1],padding='VALID')
patches_shape = patches.get_shape().as_list()
return tf.reshap... | 2.625 | 3 |
kubelet/datadog_checks/kubelet/summary.py | tcpatterson/integrations-core | 0 | 27540 | <filename>kubelet/datadog_checks/kubelet/summary.py
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from __future__ import division
from fnmatch import fnmatch
from datadog_checks.base.utils.tagging import tagger
from .common import replace_container_rt_pr... | 1.953125 | 2 |
Search_result/srr9.py | tanayz/Kaggle | 0 | 27541 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 5 06:34:04 2015
@author: tanay
"""
from lasagne.layers import InputLayer, DropoutLayer, DenseLayer
from lasagne.updates import nesterov_momentum
from lasagne.objectives import binary_crossentropy
from nolearn.lasagne import NeuralNet
import theano
from theano import tens... | 2.671875 | 3 |
typarser/_base_optarg.py | ermishechkin/typarser | 0 | 27542 | from __future__ import annotations
import typing
from typing import Callable, Generic, Iterable, Literal, Optional, Tuple, Union
from ._base import RESULT, TYPE, BaseComponent
from ._internal_namespace import set_value
if typing.TYPE_CHECKING:
from ._base import Namespace
from .action import Action
NARGS... | 2.203125 | 2 |
docs/tutorial/local.py | prodigyfinance/ml2p | 3 | 27543 | # -*- coding: utf-8 -*-
""" Train the Boston house prices model on your local machine.
"""
import pandas as pd
from ml2p.core import LocalEnv
import model
def train(env):
""" Train and save the model locally. """
trainer = model.BostonModel().trainer(env)
trainer.train()
def predict(env):
""" Load... | 3.40625 | 3 |
examples/decorator_args.py | gwilkes/botpie | 0 | 27544 | <reponame>gwilkes/botpie<gh_stars>0
import botpie
import random
message = botpie.utils.argvstr()
bot = botpie.Bot("InfoBot")
@bot.command("sens")
@bot.argument("game", default="ow", nargs="?", help="pick a game")
def sens(game):
gamesens = {
"ow": "2.1",
"cod": "3",
"d2": "4"
... | 2.96875 | 3 |
src/PyMud/model/account.py | NichCritic/pymud | 0 | 27545 | <gh_stars>0
'''
Created on Nov 27, 2011
@author: Nich
'''
import uuid
from model.base import Base
from sqlalchemy import Column, String, ForeignKey
from sqlalchemy.orm import relationship
class Account(Base):
__tablename__ = "account"
id = Column(String, primary_key=True)
first_name = Column(Strin... | 2.984375 | 3 |
elevadorJahNoUltimoAndarException.py | IpRocha1/dsoo_exercicio_6 | 0 | 27546 | class ElevadorJahNoUltimoAndarException( ...
| 1.171875 | 1 |
pysatModels/models/__init__.py | pysat/pysatModelUtils | 0 | 27547 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2022, pysat development team
# Full license can be found in License.md
# -----------------------------------------------------------------------------
"""Routines for loading model data into a pysat Instrument object."""
# Import key modules and skip F401 t... | 1.8125 | 2 |
backend/accounts/serializers.py | hvitis/geodjango-rest-vue-boilerplate | 5 | 27548 | <filename>backend/accounts/serializers.py
from rest_framework_gis.serializers import GeoFeatureModelSerializer, GeometrySerializerMethodField
from django.contrib.gis.geos import Point
from accounts.models import UserProfile
import datetime
from rest_framework_gis.pagination import GeoJsonPagination
from django.contrib... | 2.21875 | 2 |
main.py | henryfox/encrypted-chat | 0 | 27549 | <filename>main.py
import webapp2
import os
import jinja2
from google.appengine.ext import db
template_dir = os.path.join(os.path.dirname(__file__), "templates")
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir), autoescape = True)
class Handler(webapp2.RequestHandler):
def write(self,... | 2.796875 | 3 |
lib/data_processing.py | ofirmg/football2vec | 11 | 27550 | <filename>lib/data_processing.py<gh_stars>10-100
"""
Created on September 5 2021
Data processing module of football2vec. Contains classes: FootballTokenizer, Corpus.
Also contains the build_data_objects function and its nested function for building the core data objects.
@author: <NAME> (@Magdaci)
"""
import numpy ... | 2.796875 | 3 |
ipyannotator/datasets/download.py | EnriqueMoran/ipyannotator | 19 | 27551 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01a_datasets_download.ipynb (unless otherwise specified).
__all__ = ['get_cifar10', 'get_oxford_102_flowers', 'get_cub_200_2011']
# Internal Cell
import glob
import json
from pathlib import Path
import os
import subprocess
import tarfile
import urllib
import zlib
# In... | 2.75 | 3 |
airflow/plugins/operators/code_analyzer/utils/analysis/file.py | teiresias-personal-data-discovery/teiresias-system | 2 | 27552 | <reponame>teiresias-personal-data-discovery/teiresias-system
from ruamel.yaml import YAML
from pathlib import Path
from mergedeep import merge
from operators.code_analyzer.utils.analysis.tool import map_tool_to_storage_finder
from operators.code_analyzer.utils.analysis.context import collect_context
from operators.cod... | 2.1875 | 2 |
examples/openmv/simple_tracking.py | bherbruck/simple-tracker | 3 | 27553 | <gh_stars>1-10
import sensor
import image
import time
import json
from simple_tracker import Tracker
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
clock = time.clock()
green_threshold = [... | 2.375 | 2 |
ExcelToNetcdf.py | aecryan/netcdf-excel-conversion | 0 | 27554 | #!/usr/bin/env python
# coding: utf-8
#Project name: Excel --> netCDF
#Description: It receives an excel file with a predefined format and returns the equivalent file in netCDF format.
#Programmers: <NAME>
#Date: 07-09-2020
import pandas as pd
import xarray
import scipy
print("Enter the exact name of the workbo... | 3.390625 | 3 |
scripts/make_mc_scenario.py | BayAreaMetro/Lasso | 2 | 27555 | <reponame>BayAreaMetro/Lasso
import os
import pandas as pd
from network_wrangler import RoadwayNetwork
from network_wrangler import TransitNetwork
from network_wrangler import ProjectCard
from network_wrangler import Scenario
from network_wrangler import WranglerLogger
from lasso import ModelRoadwayNetwork
import warni... | 2.359375 | 2 |
973-k-closest-points-to-origin/973-k-closest-points-to-origin.py | jurayev/data-structures-algorithms-solutions | 0 | 27556 | <filename>973-k-closest-points-to-origin/973-k-closest-points-to-origin.py
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
self.dist = math.sqrt(x ** 2 + y ** 2)
class Solution:
"""
Quick Select algo:
Time best -> O(N)
Time worst -> O(N^2)
"""
de... | 3.609375 | 4 |
Models/Camera.py | arlanschouwstra/Robotica-Groep-11 | 0 | 27557 | <reponame>arlanschouwstra/Robotica-Groep-11
# import the necessary packages
from collections import deque
import numpy as np
import argparse
import imutils
import cv2
import time
class Camera:
def __init__(self):
pass
def nothing(*arg):
pass
def detect(self):
# construct the arg... | 2.921875 | 3 |
custom_components/weatheralerts/sensor.py | ikifar2012/sensor.weatheralerts | 0 | 27558 | <filename>custom_components/weatheralerts/sensor.py
"""
A component which allows you to get information about next departure from spesified stop.
For more details about this component, please refer to the documentation at
https://github.com/custom-components/sensor.weatheralerts
"""
import voluptuous as vol
from date... | 2.75 | 3 |
src/azure-cli/azure/cli/command_modules/security/tests/latest/test_security_automations_scenario.py | ZengTaoxu/azure-cli | 0 | 27559 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 2.03125 | 2 |
trypython/stdlib/argparse_/argparse01.py | devlights/try-python | 4 | 27560 | <gh_stars>1-10
"""
argparse モジュールのサンプルです。
基本的な使い方について。
参考: http://bit.ly/2UXDCIG
"""
import argparse
import sys
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# argparse モジュールを使う場合の基本は以下の手順
#
... | 3.015625 | 3 |
scripts/check_masks.py | dyollb/segmantic | 0 | 27561 | <filename>scripts/check_masks.py<gh_stars>0
import logging
from pathlib import Path
import nibabel as nib
import numpy as np
import typer
def check_masks(directory: Path, file_glob: str = "*.nii.gz"):
logger = logging.getLogger(__file__)
for file_path in directory.glob(file_glob):
img = nib.load(f"{f... | 2.453125 | 2 |
draw_classes.py | Fs-agadir/StageDetect | 0 | 27562 | <filename>draw_classes.py
# Copyright (c) 2021, Fs-Agadir
# All rights reserved.
#from wx import App, ScreenDC #to get monitor resolution
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import os, cv2
class Drawing:
def __init__(self):
pass
'''----drawing result... | 2.8125 | 3 |
batch_gnome/batch_gnome/TAP/TAP_ext/test_TAP_ext.py | dylanrighi/GnomeTools | 2 | 27563 | <reponame>dylanrighi/GnomeTools
#!/usr/bin/env python2.3
"""
A simple test routine that tests at least some of the TAP_ext package
"""
import unittest
from Numeric import *
class CalcPolygonsTestCase(unittest.TestCase):
def testCalcPolygons(self):
pass
class check_receptorsTestCase(unittest.TestCa... | 2.796875 | 3 |
ourteam/apps.py | Kgermando/parlementaires | 1 | 27564 | from django.apps import AppConfig
class OurteamConfig(AppConfig):
name = 'ourteam'
| 1.046875 | 1 |
backpack/extensions/secondorder/diag_ggn/permute.py | jabader97/backpack | 395 | 27565 | """Module defining DiagGGNPermute."""
from backpack.core.derivatives.permute import PermuteDerivatives
from backpack.extensions.secondorder.diag_ggn.diag_ggn_base import DiagGGNBaseModule
class DiagGGNPermute(DiagGGNBaseModule):
"""DiagGGN extension of Permute."""
def __init__(self):
"""Initialize.""... | 2.109375 | 2 |
tests.py | snandasena/disaster-response-pipeline | 0 | 27566 | import sys
import numpy as np
from sklearn.externals import joblib
sys.path.append("common")
from train_classifier import *
staring_verb_extractor = StartingVerbExtractor()
verb_count_extractor = VerbCountExtractor()
starting_modal_extractor = StartingModalExtractor()
noun_count_extractor = NounCountExtractor()
def... | 2.40625 | 2 |
sendim/tests/graph.py | ZuluPro/snafu | 1 | 27567 | """
"""
from django.utils import unittest
from django.core import management
from referentiel.models import Supervisor
from sendim.tests.defs import create_event, create_alert, internet_is_on
class Graph_TestCase(unittest.TestCase):
"""
Test communicaton with metrology.
"""
def setUp(self):
m... | 2.359375 | 2 |
PipelineCreator/Testing/Python/ModuleTemplateTests.py | Connor-Bowley/SlicerPipelines | 0 | 27568 | <reponame>Connor-Bowley/SlicerPipelines<filename>PipelineCreator/Testing/Python/ModuleTemplateTests.py
import unittest
from PipelineCreatorLib._Private.ModuleTemplate import ModuleTemplate
class TestModuleTemplate(unittest.TestCase):
def test_simple(self):
t = ModuleTemplate("{{name}} is here")
self.assertE... | 2.59375 | 3 |
engine/logic/Transform.py | wkta/Python-Bataille-Navale | 0 | 27569 | <reponame>wkta/Python-Bataille-Navale
# Copyright © 2019 <NAME>.
from copy import copy
from engine.logic.Math import Mat3x3, Vector2, IDENTITY_MATRIX, ZERO_VECTOR, UNIT_VECTOR
class Transform:
"""
Simple transform.
Used to give information about the objects in the scene.
Attributes:
parent ... | 3.296875 | 3 |
tools/key2java.py | rb-anssi/tataouine | 0 | 27570 | <reponame>rb-anssi/tataouine
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, array
# Import our local utils
from crypto_utils import *
def PrintUsage():
executable = os.path.basename(__file__)
print(u'\nkey2java\n\n\tUsage:\t{} token_priv_key.bin token_pub_key.bin platform_pub_key.bin shared_p... | 2.421875 | 2 |
app/maze_selector.py | rpowel/maze | 0 | 27571 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 10:44:44 2020.
@author: powel
"""
import random
from random import randint
import numpy as np
from mazes import RandomMaze, PrimMaze, KruskalMaze, RecursiveDivisionMaze, MazeBase
from percolation import check_percolation
class Maze:
def _... | 3.640625 | 4 |
my_lambdata/iqr_oop.py | karlmanalo/lambdata-karlmanalo | 0 | 27572 | <reponame>karlmanalo/lambdata-karlmanalo
# my_lambdata\iqr_oop.py
# IQR function written in terms of OOP
# Must feed in list of numbers
import numpy
import pandas
class Numbers():
def __init__(self):
pass
def iqr(self, X):
q1 = numpy.percentile(X, 25, interpolation='midpoint')
q3... | 3.53125 | 4 |
app/vendors/migrations/0030_auto_20180305_2301.py | snakrani/discovery | 0 | 27573 | <reponame>snakrani/discovery<gh_stars>0
# Generated by Django 2.0.2 on 2018-03-05 23:01
from django.db import migrations, models
import django.db.models.deletion
def migrate_membership(apps, schema_editor):
PoolPIID = apps.get_model('vendors', 'PoolPIID')
PoolMembership = apps.get_model('vendors', 'PoolMembe... | 1.875 | 2 |
hcap_utils/contrib/allauth/login_form.py | fabiommendes/capacidade_hospitalar | 0 | 27574 | from allauth.account.forms import LoginForm as AllauthLoginForm
class LoginForm(AllauthLoginForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
del self.fields["login"].widget.attrs["placeholder"]
del self.fields["password"].widget.attrs["placeholder"]
| 2.125 | 2 |
community/migrations/0013_auto_20191108_0918.py | akarakoc/Communityverse | 0 | 27575 | <reponame>akarakoc/Communityverse
# Generated by Django 2.2.6 on 2019-11-08 09:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('community', '0012_auto_20191107_1649'),
]
operations = [
migrations.AlterField(
model_name='co... | 1.523438 | 2 |
tests/test_api.py | gilbsgilbs/cruft | 0 | 27576 | import json
import os
from pathlib import Path
from subprocess import run
import pytest
from examples import verify_and_test_examples
from git import Repo
import cruft
from cruft import exceptions
from cruft._commands.utils import get_cruft_file
def test_invalid_cookiecutter_repo(tmpdir):
with pytest.raises(exc... | 2.09375 | 2 |
analysis_engine/prepare_history_dataset.py | virdesai/stock-analysis-engine | 819 | 27577 | """
Helper for loading a ``Trading History`` dataset
"""
import json
import zlib
import pandas as pd
import analysis_engine.consts as ae_consts
import spylunking.log.setup_logging as log_utils
log = log_utils.build_colorized_logger(name=__name__)
def prepare_history_dataset(
data,
compress=False,
... | 2.71875 | 3 |
scripts/count_git_changes.py | ShankarNara/shogun | 2,753 | 27578 | <reponame>ShankarNara/shogun
import os
import sys
insertions=0
deletions=0
files=0
FROMVER=""
if len(sys.argv)>1:
FROMVER=sys.argv[1]
TOVER=""
if len(sys.argv)>2:
TOVER=sys.argv[2]
TMPNAME=os.tmpnam()
VER=""
if len(FROMVER)>0:
VER=FROMVER+'..'
if len(TOVER)>0:
if len(VER)==0:
VER='..'
VER=VER+TOVER
os.system('... | 2.640625 | 3 |
pysaintcoinach/ex/language.py | icykoneko/saintcoinach-py | 7 | 27579 | <filename>pysaintcoinach/ex/language.py
from enum import Enum
class Language(Enum):
none = ""
japanese = "ja"
english = "en"
german = "de"
french = "fr"
chinese_simplified = "chs"
chinese_traditional = "cht"
korean = "ko"
unsupported = "?"
def get_code(self):
return se... | 2.984375 | 3 |
Python_lxf/Python_Basic_Operation/Python_Basic/basicValueAndFunc/Filter.py | QAlexBall/Learning_Py | 2 | 27580 | def is_odd(n):
return n % 2 == 1
def not_empty(s):
return s and s.strip()
a = list(filter(is_odd, [1, 2, 4, 5, 6, 7, 8]))
a = list(filter(lambda n : n % 2 == 1, [1, 2, 4, 5, 6, 7, 8, 9]))
b = list(filter(not_empty, ['A', '' , 'B', None, 'C', ' ']))
# filter 函数返回的是一个Iterator, 也就是一个惰性序列
print(a, b)
def _odd_iter():... | 3.875 | 4 |
toolcraft/storage/__base__.py | SpikingNeurons/toolcraft | 6 | 27581 | """
Holds the base classes for storage module.
These are special hashables whose state can be serialized on disk.
"""
import typing as t
import pathlib
import datetime
import dataclasses
import abc
from .. import util, logger, settings
from .. import marshalling as m
from .. import error as e
from . import state
# n... | 2.390625 | 2 |
scripts/pulp_test.py | rajiv256/cs531_proj_2 | 0 | 27582 | import pulp as pl
def create_affine_expression(coeffs, var_names):
assert len(coeffs) == len(var_names)
n = len(coeffs)
X = [pl.LpVariable(var_names[i]) for i in range(n)]
affine = pl.LpAffineExpression([(X[i], coeffs[i]) for i in range(n)])
return affine
def create_constraint(coeffs, var_names,... | 3.015625 | 3 |
apps/user_app/models.py | lightless233/npiss | 1 | 27583 | <reponame>lightless233/npiss
#!/usr/bin/env python2
# coding: utf8
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.hashers import make_password, check_password
__author__ = 'lightless'
__email__ = '<EMAIL>'
class PissUser(models.Model):
"""
存储用户信息
"""
... | 2.3125 | 2 |
src/models/__init__.py | WorqHat/Stanford-MRnet-Challenge | 1 | 27584 | from .MRnet import MRnet | 1.054688 | 1 |
storage/models/production_data.py | aagarwal1999/194-web-app | 0 | 27585 | <reponame>aagarwal1999/194-web-app<gh_stars>0
from storage.shared import db
import datetime
import uuid
class ProductionData(db.Model):
id = db.Column(db.String(100), primary_key=True, default=lambda: str(uuid.uuid4()))
data = db.Column(db.Text, unique=False, nullable=False)
time = db.Column(db.DateTime, ... | 2.421875 | 2 |
nostrild/nostrild.py | nibalizer/galileo | 1 | 27586 | # nostrild
# authentication and user info daemon
import getent
import os
import yaml
import ldap
from itsdangerous import TimestampSigner
from flask import Flask, abort, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
app.config['CORS_HEADERS'] = 'Content-Type'
cors = CORS(app)
def always_aut... | 2.21875 | 2 |
P3/regression.py | alepalenc/Aprendizaje-Automatico | 0 | 27587 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.feature_selection import VarianceThreshold
from sklearn.preprocessing import PolynomialFeatures, StandardScaler
from sklearn import metrics
from sklearn.bas... | 2.921875 | 3 |
Line_Bot_Server/LineUsers.py | STU-Idichi-Syoya/Linebot_ | 0 | 27588 | <gh_stars>0
from Line_Bot_Server.LineBot import line_bot_api
##### STATE #####
class LineUser:
def __init__(self,reply=None,userId=None):
'''line のユーザ情報クラス ここではreplayからUserIdを取得することも
できるし、そのままuserIdを入力できる。
そこからLine APIを通して、名前と ひとこと(status message)を取得する。
'''
#reply... | 2.59375 | 3 |
wx/stc/mixins/DrawColumnEndMixin.py | dejbug/dejan7 | 0 | 27589 | <gh_stars>0
import wx
import wx.stc
from dejan7.async.DelayedCall import *
from dejan7.wx.stc import GetRowWidths
class DrawColumnEndMixin(object):
def __init__(self, parent, color="GREY", delay=0.3, margins=[]):
self.sci = parent
self.pen = wx.Pen(color)
self.margins = margins
self.DelayedPai... | 2.171875 | 2 |
Userful_Script/decimal_to_binary.py | abc907558136/Pytorch-learning | 1 | 27590 | import numpy as np
# Represent each input by an array of its binary digits.
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])[::-1] | 3.734375 | 4 |
tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor_unittest.py | kjthegod/chromium | 231 | 27591 | # Copyright 2014 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 unittest
from telemetry.core.platform.power_monitor import android_ds2784_power_monitor
class DS2784PowerMonitorMonitorTest(unittest.TestCase):
d... | 2.6875 | 3 |
apps/common/lookups.py | gis4dis/poster_new | 4 | 27592 | from django.contrib.postgres.fields import DateTimeRangeField
from django.db.models import Lookup
from psycopg2.extras import NumericRange
@DateTimeRangeField.register_lookup
class Duration(Lookup):
lookup_name = 'duration'
def as_sql(self, compiler, connection):
lhs, lhs_params = self.process_lhs(co... | 2.3125 | 2 |
lib/pecoff/Executable.py | arizvisa/syringe | 25 | 27593 | import logging, operator, functools, itertools, array, ptypes
from ptypes import *
from .headers import *
from . import portable
class Signature(pint.enum, uint16):
# We'll just store all signature types here
_values_ = [
('IMAGE_DOS_SIGNATURE', 0x5a4d),
('IMAGE_OS2_SIGNATURE', 0x454e),
... | 2.3125 | 2 |
test/test_utils.py | undecidedzogvisrainbowvitalispotent-360/i2plib | 25 | 27594 | <gh_stars>10-100
import unittest
import os
import i2plib.sam
import i2plib.utils
class TestUtils(unittest.TestCase):
def test_session_id_generation(self):
sid = i2plib.utils.generate_session_id()
self.assertEqual(len(sid), 13)
sid = i2plib.utils.generate_session_id(8)
self.assertE... | 2.4375 | 2 |
arm64/conditional.py | c01db33f/reil | 27 | 27595 | <reponame>c01db33f/reil<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2016 <NAME> - c01db33f (at) gmail.com
#
# 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:... | 2.484375 | 2 |
open_ocr/rpc_server_base.py | jpnewman/python_ocr_api | 0 | 27596 | <gh_stars>0
import logging
import pika
LOGGER = logging.getLogger(__name__)
class RpcServer(object):
def __init__(cls, rabbit_config, logfile=None):
cls.rabbit_config = rabbit_config
cls.logfile = logfile
def _setup_logging(cls):
formatter = logging.Formatter('%(asctime)s %(levelna... | 2.15625 | 2 |
s64da_benchmark_toolkit/dbconn.py | a-masterov/s64da-benchmark-toolkit | 15 | 27597 | <reponame>a-masterov/s64da-benchmark-toolkit<filename>s64da_benchmark_toolkit/dbconn.py
import logging
import time
import psycopg2
from psycopg2.extras import DictCursor
LOG = logging.getLogger()
class DBConn:
def __init__(self, dsn, statement_timeout=0, num_retries=120, retry_wait=1, use_dict_cursor = False):... | 2.5625 | 3 |
examples/test_pos_boot_normal.py | zmdismai/tcf | 0 | 27598 | <reponame>zmdismai/tcf<gh_stars>0
#! /usr/bin/python
import tcfl.tc
import tcfl.tl
import tcfl.pos
@tcfl.tc.interconnect("ipv4_addr")
@tcfl.tc.target('pos_capable')
class _test(tcfl.tc.tc_c):
"""
Boot a target to the provisioned OS (not Provisioning OS)
"""
def eval(self, ic, target):
ic.powe... | 1.9375 | 2 |
ImGen.py | ibaranov-cp/ImGen_Circuit_Maker | 0 | 27599 | <filename>ImGen.py
#!/usr/bin/env python
#BSD 3-Clause License
#Copyright (c) 2017, <NAME>
#############################################
# CHANGE THESE VARS AS NEEDED
size = 10 #size of squares in mils
invert = False #Color invert the image
image_name = "test.png" #name of the image, can be BMP, PNG or JPG... | 3.4375 | 3 |