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 |
|---|---|---|---|---|---|---|
sandbox/pdp2/arbitrary_data/zip_files.py | projectpai/paipass | 3 | 5200 | import zipfile
import random
RAND_INT_RANGE = (1,100)
def wrf(fname):
with open(fname, 'w') as f:
for i in range(100):
f.write(str(random.randint(*RAND_INT_RANGE)))
fnames = []
for i in range(10):
fname = 'file' + str(i) + '.txt'
wrf(fname)
fnames.append(fname)
dirpaths = set()
wi... | 3.25 | 3 |
tests/testproject/testproject/tests/test_middleware.py | mwesterhof/wagtail_managed404 | 1 | 5201 | import unittest
from django.test import Client
from wagtail.core.models import Page
from wagtail_managed404.models import PageNotFoundEntry
class TestMiddleware(unittest.TestCase):
"""Tests for `wagtail_app_pages` package."""
def setUp(self):
self.client = Client()
self.invalid_url = '/defi... | 2.46875 | 2 |
src/reversion/version.py | maraujop/django-reversion | 0 | 5202 | __version__ = (1, 8, 5)
| 1.148438 | 1 |
observations/r/bomsoi.py | hajime9652/observations | 199 | 5203 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def bomsoi(path):
"""Southern Oscillation Index Data
... | 2.515625 | 3 |
openpype/hosts/houdini/plugins/publish/validate_bypass.py | dangerstudios/OpenPype | 0 | 5204 | import pyblish.api
import openpype.api
class ValidateBypassed(pyblish.api.InstancePlugin):
"""Validate all primitives build hierarchy from attribute when enabled.
The name of the attribute must exist on the prims and have the same name
as Build Hierarchy from Attribute's `Path Attribute` value on the Ale... | 2.203125 | 2 |
gavPrj/dataset_core.py | GavinK-ai/cv | 1 | 5205 | <filename>gavPrj/dataset_core.py
import os
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
#srcPaths = ('dataset/Screenshot1','dataset/Screenshot2','dataset/Screenshot3', 'dataset/Screenshot4')
#srcPaths = ('all_dataset/s1',
# 'all_dataset/s10',
# 'all_dataset/s11',
... | 2.015625 | 2 |
kronos/kronos.py | jinified/kronos | 0 | 5206 | """
Kronos: A simple scheduler for graduate training programme
Entities: User, Schedule, Rotation
"""
from operator import itemgetter
from datetime import datetime, timedelta
def getRotationCapacity(rotationId, startDate, endDate, assignments):
""" Calculate number of users assigned to a particular rotation dur... | 3.03125 | 3 |
personal_env/lib/python3.8/site-packages/pylint/lint/utils.py | jestinmwilson/personal-website | 0 | 5207 | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
import contextlib
import sys
from pylint.utils import utils
class ArgumentPreprocessingError(Exception):
"""Raised if an error occurs during argument prep... | 2.34375 | 2 |
mol_dqn/experimental/multi_obj.py | deepneuralmachine/google-research | 23,901 | 5208 | <reponame>deepneuralmachine/google-research<gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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.apac... | 1.890625 | 2 |
myuw/test/views/test_rest_search.py | uw-it-aca/myuw | 18 | 5209 | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
from django.test.utils import override_settings
from django.urls import reverse
from myuw.test.api import MyuwApiTest
@override_settings(
RESTCLIENTS_ADMIN_AUTH_MODULE='rc_django.tests.can_proxy_restcli... | 2.28125 | 2 |
examples/cli-solver/cli_solver.py | danagle/boggled | 0 | 5210 | <reponame>danagle/boggled
# cli_solver.py
import argparse
import os
from boggled import BoggleBoard, BoggleSolver, BoggleWords
def solve_board(board, words):
solver = BoggleSolver(board, words)
solver.solve()
return solver
def display_board_details(board):
print("Board details:")
print("Columns... | 3.21875 | 3 |
src/wepy/orchestration/orchestrator.py | gitter-badger/wepy-1 | 35 | 5211 | from copy import copy, deepcopy
import sqlite3
from hashlib import md5
import time
import os
import os.path as osp
from base64 import b64encode, b64decode
from zlib import compress, decompress
import itertools as it
import logging
# instead of pickle we use dill, so we can save dynamically defined
# classes
import dil... | 1.992188 | 2 |
src/generate_class_specific_samples.py | HesterLim/pytorch-cnn-visualizations | 6,725 | 5212 | """
Created on Thu Oct 26 14:19:44 2017
@author: <NAME> - github.com/utkuozbulak
"""
import os
import numpy as np
import torch
from torch.optim import SGD
from torchvision import models
from misc_functions import preprocess_image, recreate_image, save_image
class ClassSpecificImageGeneration():
"""
Pro... | 2.765625 | 3 |
sumo/tools/net/visum_mapDistricts.py | iltempe/osmosi | 0 | 5213 | #!/usr/bin/env python
"""
@file visum_mapDistricts.py
@author <NAME>
@author <NAME>
@date 2007-10-25
@version $Id$
This script reads a network and a dump file and
draws the network, coloring it by the values
found within the dump-file.
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (... | 3.265625 | 3 |
BKPMediaDetector.py | bkpifc/BKPMediaDetector | 5 | 5214 | #!/usr/bin/env python3
######
# General Detector
# 06.12.2018 / Last Update: 20.05.2021
# LRB
######
import numpy as np
import os
import sys
import tensorflow as tf
import hashlib
import cv2
import magic
import PySimpleGUI as sg
import csv
import imagehash
import face_recognition
import subprocess
from itertools impo... | 1.992188 | 2 |
src/BruteForce.py | stevenwalton/Retro-Learner | 0 | 5215 | <filename>src/BruteForce.py
import time
import retro
import FrameSkip
import TimeLimit
import Brute
class BruteForce():
def __init__(self,
game='Airstriker-Genesis',
max_episode_steps=4500,
timestep_limit=100_000_000,
state=retro.State.DEFAULT,
... | 2.859375 | 3 |
tutorials/04-advanced/03-super-resolution-onnx/main.py | yakhyo/PyTorch-Tutorials | 7 | 5216 | import io
import numpy as np
import torch.utils.model_zoo as model_zoo
import torch.onnx
import torch.nn as nn
import torch.nn.init as init
# ================================================================ #
# Building the Model #
# ====================================... | 2.46875 | 2 |
features/steps/section.py | revvsales/python-docx-1 | 3,031 | 5217 | <reponame>revvsales/python-docx-1<filename>features/steps/section.py
# encoding: utf-8
"""
Step implementations for section-related features
"""
from __future__ import absolute_import, print_function, unicode_literals
from behave import given, then, when
from docx import Document
from docx.enum.section import WD_OR... | 2.296875 | 2 |
scipy/sparse/csgraph/_laplacian.py | seberg/scipy | 1 | 5218 | """
Laplacian of a compressed-sparse graph
"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD
import numpy as np
from scipy.sparse import isspmatrix, coo_matrix
###############################################################################
# Graph laplacian
def l... | 3.453125 | 3 |
zilean/system/zilean_migrator.py | A-Hilaly/zilean | 0 | 5219 | <reponame>A-Hilaly/zilean<gh_stars>0
from .utils.migrations import (migrate_database_from,
migrate_machine_from,
zilean_rollback_database_backup,
zilean_rollback_machine_backup)
class ZileanMigrator(object):
pass
| 1.195313 | 1 |
coltran/run.py | DionysisChristopoulos/google-research | 23,901 | 5220 | <filename>coltran/run.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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
#
# Un... | 1.851563 | 2 |
train_multi_human.py | wenliangdai/sunets-reproduce | 2 | 5221 | <gh_stars>1-10
import argparse
import math
import os
import pickle
import random
import sys
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from torch import nn
from torch.optim import lr_scheduler
from torch.utils import data
import torchvision.transforms as transforms
import transforms as exten... | 2.078125 | 2 |
exemplos/exemplo-aula-14-01.py | quitaiskiluisf/TI4F-2021-LogicaProgramacao | 0 | 5222 | # Apresentação
print('Programa para somar 8 valores utilizando vetores/listas')
print()
# Declaração do vetor
valores = [0, 0, 0, 0, 0, 0, 0, 0]
# Solicita os valores
for i in range(len(valores)):
valores[i] = int(input('Informe o valor: '))
# Cálculo da soma
soma = 0
for i in range(len(valores)):
soma += va... | 4.125 | 4 |
day3/p1.py | pwicks86/adventofcode2015 | 0 | 5223 | from collections import defaultdict
f = open("input.txt")
d = f.read()
houses = defaultdict(int,{(0,0):1})
cur = [0,0]
for c in d:
if c == "<":
cur[0] -= 1
if c == ">":
cur[0] += 1
if c == "v":
cur[1] += 1
if c == "^":
cur[1] -= 1
houses[tuple(cur)]+=1
print(len(hou... | 3.046875 | 3 |
pbr/config/blend_config.py | NUbots/NUpbr | 1 | 5224 | <gh_stars>1-10
# Blender-specific Configuration Settings
from math import pi
render = {
"render_engine": "CYCLES",
"render": {"cycles_device": "GPU"},
"dimensions": {"resolution": [1280, 1024], "percentage": 100.0},
"sampling": {"cycles_samples": 256, "cycles_preview_samples": 16},
"light_paths": ... | 1.640625 | 2 |
simglucose/controller/basal_bolus_ctrller.py | mia-jingyi/simglucose | 0 | 5225 | from .base import Controller
from .base import Action
import numpy as np
import pandas as pd
import logging
from collections import namedtuple
from tqdm import tqdm
logger = logging.getLogger(__name__)
CONTROL_QUEST = 'simglucose/params/Quest.csv'
PATIENT_PARA_FILE = 'simglucose/params/vpatient_params.csv'
ParamTup = ... | 2.8125 | 3 |
ceilometer/event/trait_plugins.py | redhat-openstack/ceilometer | 1 | 5226 | #
# Copyright 2013 Rackspace Hosting.
#
# 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... | 2.0625 | 2 |
web13/jsonapi.py | gongjunhuang/web | 0 | 5227 | <reponame>gongjunhuang/web
from flask import Flask, redirect, url_for, jsonify, request
app = Flask(__name__)
users = []
'''
Json api
请求form里面Json 返回Json
好处:
1.通信的格式统一,对语言的约束就小了
2.易于做成open api
3.客户端重度渲染
RESTful api
Dr. Fielding
url 用资源来组织的 名词
/GET /players 拿到所有玩家
/GET /player/id 访问i... | 3.265625 | 3 |
cards/migrations/0012_auto_20180331_1348.py | mhndlsz/memodrop | 18 | 5228 | <reponame>mhndlsz/memodrop<filename>cards/migrations/0012_auto_20180331_1348.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-31 13:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cards', '00... | 1.640625 | 2 |
MoMMI/Modules/ss14_nudges.py | T6751/MoMMI | 18 | 5229 | import logging
from typing import Match, Any, Dict
import aiohttp
from discord import Message
from MoMMI import comm_event, command, MChannel, always_command
logger = logging.getLogger(__name__)
@comm_event("ss14")
async def ss14_nudge(channel: MChannel, message: Any, meta: str) -> None:
try:
config: Dict... | 2.265625 | 2 |
oxe-api/test/resource/company/test_get_company_taxonomy.py | CybersecurityLuxembourg/openxeco | 0 | 5230 | <reponame>CybersecurityLuxembourg/openxeco<gh_stars>0
from test.BaseCase import BaseCase
class TestGetCompanyTaxonomy(BaseCase):
@BaseCase.login
def test_ok(self, token):
self.db.insert({"id": 1, "name": "My Company"}, self.db.tables["Company"])
self.db.insert({"id": 2, "name": "My Company 2"... | 2.359375 | 2 |
spoon/models/groupmembership.py | mikeboers/Spoon | 4 | 5231 | <reponame>mikeboers/Spoon
import sqlalchemy as sa
from ..core import db
class GroupMembership(db.Model):
__tablename__ = 'group_memberships'
__table_args__ = dict(
autoload=True,
extend_existing=True,
)
user = db.relationship('Account',
foreign_keys='GroupMembership.user_id'... | 2.640625 | 3 |
nonlinear/aorta/nonlinearCasesCreation_aorta.py | HaolinCMU/Soft_tissue_tracking | 3 | 5232 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 13:08:16 2020
@author: haolinl
"""
import copy
import os
import time
import numpy as np
import random
import scipy.io # For extracting data from .mat file
class inputFileGenerator(object):
"""
Generate input file for Abaqus.... | 2.375 | 2 |
data/cache/test/test_cache.py | dongboyan77/quay | 1 | 5233 | <reponame>dongboyan77/quay
import pytest
from mock import patch
from data.cache import InMemoryDataModelCache, NoopDataModelCache, MemcachedModelCache
from data.cache.cache_key import CacheKey
class MockClient(object):
def __init__(self, server, **kwargs):
self.data = {}
def get(self, key, default=... | 2.421875 | 2 |
Packs/HealthCheck/Scripts/HealthCheckIncidentsCreatedMonthly/HealthCheckIncidentsCreatedMonthly.py | mazmat-panw/content | 2 | 5234 | <gh_stars>1-10
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
ctx = demisto.context()
dataFromCtx = ctx.get("widgets")
if not dataFromCtx:
incident = demisto.incidents()[0]
accountName = incident.get('account')
accountName = f"acc_{accountName}" if accountName !=... | 2.125 | 2 |
Bert_training.py | qzlydao/Bert_Sentiment_Analysis | 0 | 5235 | from torch.utils.data import DataLoader
from dataset.wiki_dataset import BERTDataset
from models.bert_model import *
from tqdm import tqdm
import numpy as np
import pandas as pd
import os
config = {}
config['train_corpus_path'] = './corpus/train_wiki.txt'
config['test_corpus_path'] = './corpus/test_wiki.txt'
config[... | 2.484375 | 2 |
python/triton/language/random.py | appliedml85/triton | 1 | 5236 | <filename>python/triton/language/random.py
import triton
import triton.language as tl
# Notes
# 1. triton doesn't support uint32, so we use int32 instead and benefit from the fact that two's complement operations are equivalent to uint operations.
# 2. multiply_low_high is currently inefficient.
# 3. Even though tech... | 2.5625 | 3 |
pyctcdecode/__init__.py | kensho-technologies/pyctcdecode | 203 | 5237 | # Copyright 2021-present Kensho Technologies, LLC.
from .alphabet import Alphabet # noqa
from .decoder import BeamSearchDecoderCTC, build_ctcdecoder # noqa
from .language_model import LanguageModel # noqa
__package_name__ = "pyctcdecode"
__version__ = "0.3.0"
| 0.972656 | 1 |
wumpus/start_server.py | marky1991/Legend-of-Wumpus | 0 | 5238 | <filename>wumpus/start_server.py
from wumpus.server import Server
from circuits import Debugger
s = Server("0.0.0.0", 50551) + Debugger()
s.run()
import sys
sys.exit(1)
| 1.820313 | 2 |
platypush/backend/joystick/linux/__init__.py | BlackLight/platypush | 228 | 5239 | import array
import struct
import time
from fcntl import ioctl
from typing import IO
from platypush.backend import Backend
from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, \
JoystickButtonPressedEvent, JoystickButtonReleasedEvent, JoystickAxisEvent
class JoystickLin... | 2.53125 | 3 |
src/modules/sensors/vehicle_magnetometer/mag_compensation/python/mag_compensation.py | SaxionMechatronics/Firmware | 4,224 | 5240 | <reponame>SaxionMechatronics/Firmware
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: mag_compensation.py
Author: <NAME>
Email: <EMAIL>
Github: https://github.com/baumanta
Description:
Computes linear coefficients for mag compensation from thrust and current
Usage:
python mag_compensation.py /path/to/... | 2.515625 | 3 |
app.py | 19857625778/watchlist | 0 | 5241 | from flask import Flask
app = Flask(_name_)
@app.route('/')
def hello():
return 'welcome to my watchlist' | 2.109375 | 2 |
portfolio_optimization/constants.py | AI-Traiding-Team/paired_trading | 1 | 5242 | <reponame>AI-Traiding-Team/paired_trading
import os
path1 = "outputs"
path2 = "outputs/_imgs"
path3 = "outputs/max_sharpe_weights"
path4 = "outputs/opt_portfolio_trades"
try:
os.mkdir(path1)
except OSError:
print ("Директория %s уже создана" % path1)
else:
print ("Успешно создана директория %s " % path1)
... | 1.984375 | 2 |
mypy/transformtype.py | silky/mypy | 1 | 5243 | <filename>mypy/transformtype.py
"""Transform classes for runtime type checking."""
from typing import Undefined, List, Set, Any, cast, Tuple, Dict
from mypy.nodes import (
TypeDef, Node, FuncDef, VarDef, Block, Var, ExpressionStmt,
TypeInfo, SuperExpr, NameExpr, CallExpr, MDEF, MemberExpr, ReturnStmt,
Ass... | 2.4375 | 2 |
jazzpos/admin.py | AhmadManzoor/jazzpos | 5 | 5244 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django_tablib.admin import TablibAdmin
from jazzpos.models import Customer, Patient, Store, CustomerType, StoreSettings
from jazzpos.models import UserProfile
class CustomerAdmin(TablibAd... | 1.867188 | 2 |
classification/imaterialist_challenge_furniture_2018/configs/train/train_inceptionresnetv2_350_ssd_like_v3.py | vfdev-5/ignite-examples | 11 | 5245 | # Basic training configuration file
from torch.optim import RMSprop
from torch.optim.lr_scheduler import MultiStepLR
from torchvision.transforms import RandomHorizontalFlip, Compose
from torchvision.transforms import RandomResizedCrop, RandomAffine, RandomApply
from torchvision.transforms import ColorJitter, ToTensor, ... | 2.0625 | 2 |
examples/qmmm/02-mcscf.py | QuESt-Calculator/pyscf | 501 | 5246 | #!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
A simple example to run MCSCF with background charges.
'''
import numpy
from pyscf import gto, scf, mcscf, qmmm
mol = gto.M(atom='''
C 1.1879 -0.3829 0.0000
C 0.0000 0.5526 0.0000
O -1.1867 -0.2472 0.0000
H -1.9237 0.3850 0.0000
H ... | 2.546875 | 3 |
mtp_send_money/apps/send_money/utils.py | uk-gov-mirror/ministryofjustice.money-to-prisoners-send-money | 0 | 5247 | import datetime
from decimal import Decimal, ROUND_DOWN, ROUND_UP
import logging
import re
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.utils import formats
from django.utils.cache import patch_cache_control
from djang... | 2.1875 | 2 |
src/zmbrelev/config.py | Zumbi-ML/zmbRELEV | 0 | 5248 | # -*- coding: UTF-8 -*-
import os
this_file_path = os.path.dirname(os.path.realpath(__file__))
MODELS_DIR = os.path.join(this_file_path, "models/")
| 1.601563 | 2 |
ArraysP2.py | EdgarVallejo96/pyEdureka | 0 | 5249 | <reponame>EdgarVallejo96/pyEdureka<filename>ArraysP2.py
import array as arr
a = arr.array('i', [ 1,2,3,4,5,6])
print(a)
# Accessing elements
print(a[2])
print(a[-2])
# BASIC ARRAY OPERATIONS
# Find length of array
print()
print('Length of array')
print(len(a))
# Adding elments to an array
# append() to add a single ... | 4.03125 | 4 |
vesper/mpg_ranch/nfc_detector_low_score_classifier_1_0/classifier.py | RichardLitt/Vesper | 29 | 5250 | <reponame>RichardLitt/Vesper<filename>vesper/mpg_ranch/nfc_detector_low_score_classifier_1_0/classifier.py
"""
Module containing low score classifier for MPG Ranch NFC detectors.
An instance of the `Classifier` class of this module assigns the `LowScore`
classification to a clip if the clip has no `Classification` ann... | 2.375 | 2 |
setup.py | yitzikc/athena2pd | 1 | 5251 | <filename>setup.py
from setuptools import setup, find_packages
def find_version(path):
import re
# path shall be a plain ascii tetxt file
s = open(path, 'rt').read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", s, re.M)
if version_match:
return version_match.group(1)
... | 2.125 | 2 |
mmdet/core/ufp/__init__.py | PuAnysh/UFPMP-Det | 9 | 5252 | <reponame>PuAnysh/UFPMP-Det
from .spp import *
from .unified_foreground_packing import *
__all__ = [
'phsppog', 'UnifiedForegroundPacking'
]
| 1.070313 | 1 |
PythonBasics/ExamPreparation/FamilyTrip.py | achoraev/SoftUni | 0 | 5253 | budget = float(input())
nights = int(input())
price_night = float(input())
percent_extra = int(input())
if nights > 7:
price_night = price_night - (price_night * 0.05)
sum = nights * price_night
total_sum = sum + (budget * percent_extra / 100)
if total_sum <= budget:
print(f"Ivanovi will be left ... | 3.703125 | 4 |
tex_live_package_manager/progress.py | csch0/SublimeText-TeX-Live-Package-Manager | 2 | 5254 | <reponame>csch0/SublimeText-TeX-Live-Package-Manager
import sublime, sublime_plugin
import threading
class ProcessQueueManager():
__shared = {}
items = []
thread = None
# Current item details
messages = None
function = None
callback = None
# Progress Bar preferences
i = 0
size = 8
add = 1
def __new__... | 2.390625 | 2 |
moscow_routes_parser/t_mos_ru.py | rscprof/moscow_routes_parser | 0 | 5255 | <filename>moscow_routes_parser/t_mos_ru.py
import html
import json
import logging
import re
from abc import abstractmethod
from datetime import datetime, time
from typing import Optional
import requests
from moscow_routes_parser.model import Route, Timetable, Equipment, Timetable_builder
from moscow_routes_parser.mod... | 3.078125 | 3 |
web/api/get_summary_data.py | spudmind/spud | 2 | 5256 | from web.api import BaseAPI
from utils import mongo
import json
class DataApi(BaseAPI):
def __init__(self):
BaseAPI.__init__(self)
self._db = mongo.MongoInterface()
self.query = {}
self.fields = {
"donation_count": "$influences.electoral_commission.donation_count",
... | 2.359375 | 2 |
neutron/common/ovn/utils.py | guillermomolina/neutron | 3 | 5257 | # 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 writing, software
# d... | 1.390625 | 1 |
ens/exceptions.py | pjryan93/web3.py | 326 | 5258 | import idna
class AddressMismatch(ValueError):
'''
In order to set up reverse resolution correctly, the ENS name should first
point to the address. This exception is raised if the name does
not currently point to the address.
'''
pass
class InvalidName(idna.IDNAError):
'''
This excep... | 2.984375 | 3 |
Submods/MAS Additions/MASM/scripts/midi_input.py | CaptainHorse/MAS-Additions | 13 | 5259 | <filename>Submods/MAS Additions/MASM/scripts/midi_input.py
import mido
from socketer import MASM
inPort = None
doReadInput = False
def Start():
global inPort
try:
print(f"MIDI inputs: {mido.get_input_names()}")
inPort = mido.open_input()
print(f"MIDI input open: {inPort}")
except Exception as e:
inPort = N... | 2.40625 | 2 |
dash_carbon_components/Column.py | Matheus-Rangel/dash-carbon-components | 4 | 5260 | <reponame>Matheus-Rangel/dash-carbon-components
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Column(Component):
"""A Column component.
Row Column
Keyword arguments:
- children (list of a list of or a singular dash component, string or numbers... | 2.078125 | 2 |
src/backend/schemas/vps.py | ddddhm1/LuWu | 658 | 5261 | from typing import List
from typing import Optional
from typing import Union
from models.vps import VpsStatus
from schemas.base import APIModel
from schemas.base import BasePagination
from schemas.base import BaseSchema
from schemas.base import BaseSuccessfulResponseModel
class VpsSshKeySchema(APIModel):
name: s... | 2.203125 | 2 |
main.py | hari-sh/sigplot | 0 | 5262 | <filename>main.py
import sigplot as sp
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
matplotlib.rcParams['toolbar'] = 'None'
plt.style.use('dark_background')
fig = plt.figure()
# seed = np.linspace(3, 7, 1000)
# a = (np.sin(2 * np.pi * seed))
# b = (np.cos(2 * np.pi * seed))
# s... | 2.4375 | 2 |
test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py | msyyc/autorest.python | 0 | 5263 | <filename>test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py<gh_stars>0
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT Lic... | 1.765625 | 2 |
baseplate_py_upgrader/docker.py | reddit/baseplate.py-upgrader | 6 | 5264 | <reponame>reddit/baseplate.py-upgrader
import logging
import re
from pathlib import Path
from typing import Match
logger = logging.getLogger(__name__)
IMAGE_RE = re.compile(
r"/baseplate-py:(?P<version>[0-9.]+(\.[0-9]+)?)-py(?P<python>[23]\.[0-9]+)-(?P<distro>(bionic|buster))(?P<repo>-artifactory)?(?P<dev>-dev... | 2.640625 | 3 |
model/swtz_ty.py | ArcherLuo233/election-s-prediction | 0 | 5265 | <reponame>ArcherLuo233/election-s-prediction
from sqlalchemy import Column, ForeignKey, Integer, String, Text
from model.base import Base
class SWTZ_TY(Base):
__tablename__ = 'swtz_ty'
class_name = '商务团组-团员'
foreign_key = 'swtz_id'
export_docx = False
export_handle_file = ['identity']
field ... | 2.25 | 2 |
amy/dashboard/tests/test_autoupdate_profile.py | code-review-doctor/amy | 53 | 5266 | from django.urls import reverse
from consents.models import Consent, Term
from workshops.models import KnowledgeDomain, Person, Qualification
from workshops.tests.base import TestBase
class TestAutoUpdateProfile(TestBase):
def setUp(self):
self._setUpAirports()
self._setUpLessons()
self._... | 2.1875 | 2 |
bot/recognizer_bot/yolo/common/utils.py | kprokofi/animal-recognition-with-voice | 1 | 5267 | import numpy as np
import time
import cv2
import colorsys
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Activation, ReLU, Multiply
# Custom objects from backbones package https://github.com/david8862/keras-YOLOv3-model-set/tree/master/common/backbones
def mish(... | 2.859375 | 3 |
ros/src/tl_detector/light_classification/tl_classifier.py | PhilippHafe/CarND-Capstone | 0 | 5268 | <reponame>PhilippHafe/CarND-Capstone
from styx_msgs.msg import TrafficLight
import tensorflow as tf
import numpy as np
import datetime
class TLClassifier(object):
def __init__(self):
PATH_TO_CKPT = "light_classification/frozen_inference_graph.pb"
self.graph = tf.Graph()
self.threshold = 0.5... | 2.640625 | 3 |
testGMDS.py | ctralie/SiRPyGL | 7 | 5269 | #Based off of http://wiki.wxpython.org/GLCanvas
#Lots of help from http://wiki.wxpython.org/Getting%20Started
from OpenGL.GL import *
import wx
from wx import glcanvas
from Primitives3D import *
from PolyMesh import *
from LaplacianMesh import *
from Geodesics import *
from PointCloud import *
from Cameras3D import *
... | 2.078125 | 2 |
PySS/fem.py | manpan-1/PySS | 2 | 5270 | import matplotlib.pyplot as plt
import numpy as np
import pickle
# import csv
# from collections import namedtuple
# from mpl_toolkits.mplot3d import Axes3D
# import matplotlib.animation as animation
# import matplotlib.colors as mc
class FEModel:
def __init__(self, name=None, hist_data=None):
self.name =... | 2.859375 | 3 |
gigamonkeys/get.py | gigamonkey/sheets | 0 | 5271 | #!/usr/bin/env python
import json
import sys
from gigamonkeys.spreadsheets import spreadsheets
spreadsheet_id = sys.argv[1]
ranges = sys.argv[2:]
data = spreadsheets().get(spreadsheet_id, include_grid_data=bool(ranges), ranges=ranges)
json.dump(data, sys.stdout, indent=2)
| 2.203125 | 2 |
config.py | mhmddpkts/Get-Turkish-Words-with-Web-Scraping | 0 | 5272 |
root_URL = "https://tr.wiktionary.org/wiki/Vikis%C3%B6zl%C3%BCk:S%C3%B6zc%C3%BCk_listesi_"
filepath = "words.csv"
#letters=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
# "P","R","S","T","U","V","Y","Z"] ##İ,Ç,Ö,Ş,Ü harfleri not work correctly
letters=["C"] | 2.171875 | 2 |
sow_generator/tasks.py | praekelt/sow-generator | 1 | 5273 | <filename>sow_generator/tasks.py
from github3 import login
from github3.models import GitHubError
from celery import task
from celery.decorators import periodic_task
from celery.task.schedules import crontab
from sow_generator.models import Repository, AuthToken
def _sync_repository(obj):
dirty = False
token... | 2.28125 | 2 |
sources/wrappers.py | X-rayLaser/keras-auto-hwr | 0 | 5274 | import numpy as np
from sources import BaseSource
from sources.base import BaseSourceWrapper
from sources.preloaded import PreLoadedSource
import json
class WordsSource(BaseSource):
def __init__(self, source):
self._source = source
def __len__(self):
return len(self._source)
def _remove_... | 2.515625 | 3 |
multiworld/multiworld/core/image_env.py | yufeiwang63/ROLL | 11 | 5275 | <reponame>yufeiwang63/ROLL
import random
import cv2
import numpy as np
import warnings
from PIL import Image
from gym.spaces import Box, Dict
from multiworld.core.multitask_env import MultitaskEnv
from multiworld.core.wrapper_env import ProxyEnv
from multiworld.envs.env_util import concatenate_box_spaces
from multiwo... | 2.25 | 2 |
sample_full_post_processor.py | huynguyen82/Modified-Kaldi-GStream-OnlineServer | 0 | 5276 | #!/usr/bin/env python
import sys
import json
import logging
from math import exp
import requests as rq
import re
### For NLP post-processing
header={"Content-Type": "application/json"}
message='{"sample":"Hello bigdata"}'
api_url="http://192.168.1.197:11992/norm"
###
def NLP_process_output(pre_str):
try: ... | 2.6875 | 3 |
lang_detect_gears.py | AlexMikhalev/cord19redisknowledgegraph | 7 | 5277 | <reponame>AlexMikhalev/cord19redisknowledgegraph<gh_stars>1-10
from langdetect import detect
def detect_language(x):
#detect language of the article
try:
lang=detect(x['value'])
except:
lang="empty"
execute('SET', 'lang_article:' + x['key'], lang)
if lang!='en':
execute('... | 2.40625 | 2 |
daemon/core/coreobj.py | shanv82/core | 0 | 5278 | """
Defines the basic objects for CORE emulation: the PyCoreObj base class, along with PyCoreNode,
PyCoreNet, and PyCoreNetIf.
"""
import os
import shutil
import socket
import threading
from socket import AF_INET
from socket import AF_INET6
from core.data import NodeData, LinkData
from core.enumerations import LinkTy... | 2.859375 | 3 |
abc/128/b.py | wotsushi/competitive-programming | 3 | 5279 | # 入力
N = int(input())
S, P = (
zip(*(
(s, int(p))
for s, p in (input().split() for _ in range(N))
)) if N else
((), ())
)
ans = '\n'.join(
str(i)
for _, _, i in sorted(
zip(
S,
P,
range(1, N + 1)
),
key=lambda t: (t[0], -t[... | 3.03125 | 3 |
additional/hashcat_crack.py | mmmds/WirelessDiscoverCrackScan | 2 | 5280 | # External cracking script, part of https://github.com/mmmds/WirelessDiscoverCrackScan
import datetime
import subprocess
import os
### CONFIGURATION
HASHCAT_DIR = "C:\\hashcat-5.1.0"
HASHCAT_EXE = "hashcat64.exe"
LOG_FILE = "crack_log.txt"
DICT_DIR = "./dicts"
def load_dict_list():
for r,d,f in os.walk(DICT_DIR)... | 2.453125 | 2 |
editortools/player.py | bennettdc/MCEdit-Unified | 237 | 5281 | """Copyright (c) 2010-2012 <NAME>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
W... | 1.46875 | 1 |
seismic/checkpointing/checkpoint.py | slimgroup/Devito-Examples | 7 | 5282 | # The MIT License (MIT)
#
# Copyright (c) 2016, Imperial College, London
#
# 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... | 1.9375 | 2 |
lbrynet/file_manager/EncryptedFileManager.py | shyba/lbry | 1 | 5283 | """
Keep track of which LBRY Files are downloading and store their LBRY File specific metadata
"""
import logging
import os
from twisted.enterprise import adbapi
from twisted.internet import defer, task, reactor
from twisted.python.failure import Failure
from lbrynet.reflector.reupload import reflect_stream
from lbr... | 2.15625 | 2 |
Perforce/AppUtils.py | TomMinor/MayaPerforce | 13 | 5284 | <filename>Perforce/AppUtils.py
import os
import sys
import re
import logging
p4_logger = logging.getLogger("Perforce")
# Import app specific utilities, maya opens scenes differently than nuke etc
# Are we in maya or nuke?
if re.match( "maya", os.path.basename( sys.executable ), re.I ):
p4_logger.info("Conf... | 2.09375 | 2 |
fhir/immunizations_demo/models/trainer/model.py | kourtneyshort/healthcare | 0 | 5285 | <reponame>kourtneyshort/healthcare
#!/usr/bin/python3
#
# Copyright 2018 Google LLC
#
# 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
#
# Unl... | 2.484375 | 2 |
heliosburn/django/hbproject/webui/models.py | thecodeteam/heliosburn | 0 | 5286 | <gh_stars>0
import json
import re
from django.conf import settings
import requests
from webui.exceptions import BadRequestException, UnauthorizedException, ServerErrorException, RedirectException, \
UnexpectedException, LocationHeaderNotFoundException, NotFoundException
def validate_response(response):
if 200... | 2.203125 | 2 |
src/ychaos/core/verification/controller.py | sushilkar/ychaos | 0 | 5287 | # Copyright 2021, Yahoo
# Licensed under the terms of the Apache 2.0 license. See the LICENSE file in the project root for terms
import time
from typing import Dict, List, Optional, Type
from pydantic import validate_arguments
from ...app_logger import AppLogger
from ...testplan import SystemState
from ...testplan.... | 2.328125 | 2 |
tests/test_vimeodl.py | binary-signal/vimeo-channel-downloader | 6 | 5288 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from vimeodl import __version__
from vimeodl.vimeo import VimeoLinkExtractor, VimeoDownloader
def test_version():
assert __version__ == '0.1.0'
def test_vimeo_link_extractor():
vm = VimeoLinkExtractor()
vm.extract()
| 2.125 | 2 |
labgraph/graphs/node_test_harness.py | Yunusbcr/labgraph | 124 | 5289 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import asyncio
import functools
import inspect
from contextlib import contextmanager
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Generic,
Iterator,
List,
Mapping,
Opti... | 2.328125 | 2 |
pygamelearning/lrud.py | edward70/2021Computing | 0 | 5290 | <filename>pygamelearning/lrud.py
import pygame
import sys
pygame.init()
clock = pygame.time.Clock()
screen = pygame.display.set_mode([500, 500])
gameOn = True
x1 = 0
y1 = 100
x2 = 100
y2 = 0
while gameOn == True:
screen.fill([255,255,255])
for event in pygame.event.get():
if event.type == pygame.QUIT... | 3.703125 | 4 |
pytorch/xor/training_a_perceptron.py | e93fem/PyTorchNLPBook | 0 | 5291 | import numpy as np
import torch
import matplotlib.pyplot as plt
from torch import optim, nn
from pytorch.xor.multilayer_perceptron import MultilayerPerceptron
from pytorch.xor.utils import LABELS, get_toy_data, visualize_results, plot_intermediate_representations
input_size = 2
output_size = len(set(LABELS))
num_hidd... | 2.765625 | 3 |
mysite/api/v0/tests.py | raccoongang/socraticqs2 | 3 | 5292 | <reponame>raccoongang/socraticqs2
import json
import mock
from django.core.urlresolvers import reverse
from pymongo.errors import ServerSelectionTimeoutError
from analytics.models import CourseReport
from core.common.mongo import c_onboarding_status, _conn
from core.common import onboarding
from ct.models import Un... | 2.203125 | 2 |
signbank/settings/base.py | anthonymark33/Global-signbank | 0 | 5293 | # Django settings for signbank project.
import os
from signbank.settings.server_specific import *
from datetime import datetime
DEBUG = True
PROJECT_DIR = os.path.dirname(BASE_DIR)
MANAGERS = ADMINS
TIME_ZONE = 'Europe/Amsterdam'
LOCALE_PATHS = [BASE_DIR+'conf/locale']
# in the database, SITE_ID 1 is example.com
... | 1.945313 | 2 |
ocs_ci/ocs/cluster.py | crombus/ocs-ci | 0 | 5294 | <filename>ocs_ci/ocs/cluster.py
"""
A module for all rook functionalities and abstractions.
This module has rook related classes, support for functionalities to work with
rook cluster. This works with assumptions that an OCP cluster is already
functional and proper configurations are made for interaction.
"""
import ... | 2.1875 | 2 |
scenic/projects/baselines/detr/configs/detr_config.py | techthiyanes/scenic | 0 | 5295 | <reponame>techthiyanes/scenic<gh_stars>0
# pylint: disable=line-too-long
r"""Default configs for COCO detection using DETR.
"""
# pylint: enable=line-too-long
import copy
import ml_collections
_COCO_TRAIN_SIZE = 118287
NUM_EPOCHS = 300
def get_config():
"""Returns the configuration for COCO detection using DETR."... | 1.695313 | 2 |
tests/conftest.py | artembashlak/share-youtube-to-mail | 0 | 5296 | import pytest
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
@pytest.fixture(scope="function")
def browser():
options = webdriver.ChromeOptions()
options.add_argument('ignore-certificate-errors')
options.add_argument("--headless")
options.add_argument('--no-san... | 2.25 | 2 |
prepare_cicero_peaks.py | lab-medvedeva/SCABFA-feature-selection | 0 | 5297 | <gh_stars>0
from scale.dataset import read_mtx
from argparse import ArgumentParser
import pandas as pd
import numpy as np
import os
def parse_args():
parser = ArgumentParser('Preparing raw peaks from cicero pipeline')
parser.add_argument('--dataset_path', help='Path to Scale dataset: count, feature, barcode... | 2.734375 | 3 |
crusoe_observe/neo4j-client/neo4jclient/CMSClient.py | CSIRT-MU/CRUSOE | 3 | 5298 | <gh_stars>1-10
from neo4jclient.AbsClient import AbstractClient
class CMSClient(AbstractClient):
def __init__(self, password, **kwargs):
super().__init__(password=password, **kwargs)
def get_domain_names(self):
"""
Gets all domain names from database.
:return: domain names in... | 2.59375 | 3 |
location.py | jonasjucker/wildlife-telegram | 0 | 5299 | import time
from datetime import date,datetime
from astral import LocationInfo
from astral.sun import sun
class CamLocation:
def __init__(self,lat,lon,info,country,timezone):
self.info = LocationInfo(info, country, timezone, lat, lon)
def is_night(self):
s = sun(self.info.observer, date=date.t... | 3.296875 | 3 |