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 |
|---|---|---|---|---|---|---|
city-infrastructure-platform/settings.py | City-of-Helsinki/city-infrastructure-platform | 2 | 10500 | """
Django settings for city-infrastructure-platform project.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
import environ
import sentry_sdk
from djan... | 2.0625 | 2 |
test/tc/tet_tc_base_predict_multiclass.py | dumpmemory/Pytorch-NLU | 115 | 10501 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/7/25 19:30
# @author : Mo
# @function: predict model, 预测模块-多类分类
# 适配linux
import platform
import json
import sys
import os
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
path_sys = os.path.join(path_root, "pytorch_nlu", "pyto... | 2.5625 | 3 |
tests/test_create_spreadsheet_values.py | Tunous/StringSheet | 14 | 10502 | import unittest
from stringsheet.parser import create_spreadsheet_values
from stringsheet.parser import create_language_sheet_values
from stringsheet.parser import parse_resources
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.resources = parse_resources('test-resources/res')
class Create... | 2.609375 | 3 |
libs/imgutils.py | EpicKiwi/projet-datascience | 0 | 10503 | <reponame>EpicKiwi/projet-datascience
import cv2
def img_path2array(path):
return cv2.cvtColor(cv2.imread(path, 10), cv2.COLOR_BGR2RGB)
def img_array2file(path, array):
cv2.imwrite(path, cv2.cvtColor(array, cv2.COLOR_RGB2BGR)) | 2.515625 | 3 |
bin/nsa_fail/nsa_fail.py | changhoonhahn/SEDflow | 18 | 10504 | import os, sys
import numpy as np
from sedflow import obs as Obs
from sedflow import train as Train
from provabgs import infer as Infer
from provabgs import models as Models
####################################################
# input
####################################################
sample = sys.argv[1]
itrain... | 2.0625 | 2 |
studio/gs_provider.py | NunoEdgarGFlowHub/studio | 0 | 10505 | import json
import time
import re
from .keyvalue_provider import KeyValueProvider
from .gcloud_artifact_store import GCloudArtifactStore
from .util import timeit
class GSProvider(KeyValueProvider):
def __init__(self, config, blocking_auth=True, verbose=10, store=None):
self.config = config
self.b... | 2.140625 | 2 |
gslib/tests/test_ls.py | MikeJeffrey/gsutil | 0 | 10506 | <filename>gslib/tests/test_ls.py
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | 1.773438 | 2 |
onadata/libs/utils/audit.py | ubpd/kobocat | 0 | 10507 | # coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
HOME_ACCESSED = "home-accessed"
| 1.039063 | 1 |
places/management/commands/load_places.py | aevtikheev/dvmn-yandex-afisha | 0 | 10508 | import logging
from urllib.parse import unquote, urlparse
from pathlib import PurePosixPath
import requests
from requests.exceptions import ReadTimeout, ConnectionError, HTTPError
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from places.models import Place, Image
... | 2.203125 | 2 |
gslib/utils/ls_helper.py | dickmao/gsutil | 1 | 10509 | # -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 1.460938 | 1 |
app/config/cnMysql.py | itay-moav/rahl_commander | 1 | 10510 | <filename>app/config/cnMysql.py
'''
Created on Dec 28, 2021
@author: Itay
Abstracting the DB connection piece
'''
import mysql.connector as My
from app import logging as L
from app import exceptions as exceptions
class Connection():
'''
Abstracting the actions on a DB
'''
def __init__(self, connectio... | 2.796875 | 3 |
src/detector/pre_process_test_data.py | DomGonthier/PecheFantome | 0 | 10511 | import os
from tqdm import tqdm
import cv2
import numpy as np
#pre process test data:
path = "raw_test_data/"
list_width = []
list_height = []
list_image = []
def pre_process():
print("analyze images")
for Files in tqdm(os.listdir(path)):
if "jpg" in Files:
#print(Files)
img = ... | 2.859375 | 3 |
tensorflow/python/training/localhost_cluster_performance_test.py | connectthefuture/tensorflow | 101 | 10512 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.796875 | 2 |
extractor/util.py | bcskda/vk-archive-deepercopy | 1 | 10513 | import functools
import glob
import itertools
import logging
import os
from progressbar import progressbar
import re
import requests
from typing import List
class ValueSingleDispatch:
def __init__(self):
self._handlers = dict()
def register(self, key):
def decorator(fn: callable):
... | 2.46875 | 2 |
setup.py | gillins/pyshepseg | 5 | 10514 | <reponame>gillins/pyshepseg
#Copyright 2021 <NAME> and <NAME>. All rights reserved.
#
#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 ri... | 1.703125 | 2 |
src/utils.py | daochenzha/SimTSC | 23 | 10515 | import os
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def read_dataset_from_npy(path):
""" Read dataset from .npy file
"""
data = np.load(path, allow_pickle=True)
return data[()]['X'], data[()]['y'], data[()]['train_idx'], data[()]['test_idx']
def read_dataset... | 2.875 | 3 |
mpinterfaces/mat2d/friction/analysis.py | yw-fang/MPInterfaces | 56 | 10516 | <filename>mpinterfaces/mat2d/friction/analysis.py
from __future__ import print_function, division, unicode_literals
import os
import warnings
import numpy as np
from scipy import interpolate
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from pymatgen.io.vasp.outputs import Vasprun
from py... | 2.96875 | 3 |
aiopylimit/tests/test_aiopylimit.py | zealotous/aiopylimit | 4 | 10517 | from aiopylimit import AIOPyRateLimit
from aiopylimit import AIOPyRateLimitException
import asynctest
import asyncio
class TestPyLimit(asynctest.TestCase):
async def test_exception(self):
limit = AIOPyRateLimit(10, 10)
await self.assertAsyncRaises(AIOPyRateLimitException,
... | 2.40625 | 2 |
bookworm/platform_services/_win32/tesseract_download.py | mush42/bookworm | 18 | 10518 | # coding: utf-8
import sys
import shutil
import requests
import wx
from pathlib import Path
from urllib.parse import urljoin, urlsplit
from tempfile import TemporaryFile
from zipfile import ZipFile
from bookworm import typehints as t
from bookworm import app
from bookworm.http_tools import RemoteJsonResource, HttpReso... | 2.234375 | 2 |
python/plugins/processing/algs/grass7/ext/v_proj.py | dyna-mis/Hilabeling | 0 | 10519 | # -*- coding: utf-8 -*-
"""
***************************************************************************
v_proj.py
---------
Date : November 2017
Copyright : (C) 2017 by <NAME>
Email : medspx at medspx dot fr
*************************************************... | 1.890625 | 2 |
examples/diode/gmsh_diode2d.py | QuantumOfMoose/devsim | 0 | 10520 | <filename>examples/diode/gmsh_diode2d.py
# Copyright 2013 Devsim 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
#
# Unless required by ... | 2.453125 | 2 |
python/astro_imaging/config.py | taranu/astro_imaging | 0 | 10521 | <reponame>taranu/astro_imaging
from dataclasses import dataclass
import os
path_base_default = os.getenv('ASTRO_IMAGING_DATA_PATH', default='./')
@dataclass
class Paths:
base: str = path_base_default
catalogs: str = None
images: str = None
def __post_init__(self):
if self.catalogs is None:
... | 2.421875 | 2 |
AT.py | MTandHJ/roboc | 8 | 10522 | <reponame>MTandHJ/roboc
#!/usr/bin/env python
from typing import Tuple
import argparse
from src.loadopts import *
METHOD = "RobOC-AT"
SAVE_FREQ = 5
PRINT_FREQ = 20
FMT = "{description}={scale}-{leverage}" \
"={learning_policy}-{optimizer}-{lr}" \
"={attack}-{epsilon:.4f}-{stepsize}-{steps}" \
... | 2.46875 | 2 |
notesapp/api_v1/models.py | kampkelly/drf_template | 0 | 10523 | from django.db import models
# Create your models here.
class CommonFieldsMixin(models.Model):
"""Add created_at and updated_at fields."""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
class Meta:
"""Define metadata options.... | 2.421875 | 2 |
src/main_TS_tsconv_jma.py | inoue0406/radarJMA | 6 | 10524 | # seq2seq LSTM (no-convolutional model) for time series prediction
import numpy as np
import torch
import torchvision
import torch.utils.data as data
import torchvision.transforms as transforms
import pandas as pd
import h5py
import os
import sys
import json
import time
import pdb
from jma_timeseries_dataset import... | 2.296875 | 2 |
bell2014/energy/prob_abs_s.py | dmaugis/intrinsic | 134 | 10525 | <gh_stars>100-1000
import numpy as np
class ProbAbsoluteShading(object):
def __init__(self, params):
self.params = params
def cost(self, s_nz):
if self.params.abs_shading_weight:
if self.params.abs_shading_log:
return self.params.abs_shading_weight * \
... | 2.3125 | 2 |
onemsdk/parser/tag.py | mvnm/onemsdk | 0 | 10526 | import inspect
import sys
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Union, Type, Optional, Dict, Any
from pydantic import BaseModel
from onemsdk.exceptions import NodeTagMismatchException, ONEmSDKException
from .node import Node
__all__ = ['Tag', 'HeaderTag', 'FooterTag', 'Br... | 2.390625 | 2 |
backend/syntax/rule.py | austinmarsray/Ccompiler | 0 | 10527 | class Sign:
"""
符号
"""
def __init__(self, sign_type, sign_str='', sign_line=-1):
"""
构造
:param sign_type: 符号的类型
:param sign_str: 符号的内容(可以为空)
:param sign_line: 符号所在行数(可以为空)
"""
self.type = sign_type
self.str = sign_str
self.line = si... | 3.609375 | 4 |
redash/models.py | slachiewicz/redash | 1 | 10528 | import json
import hashlib
import logging
import os
import threading
import time
import datetime
import itertools
import peewee
from passlib.apps import custom_app_context as pwd_context
from playhouse.postgres_ext import ArrayField, DateTimeTZField, PostgresqlExtDatabase
from flask.ext.login import UserMixin, Anonymo... | 2 | 2 |
xclib/classifier/ova.py | sushantsondhi/pyxclib | 4 | 10529 | <reponame>sushantsondhi/pyxclib<gh_stars>1-10
import numpy as np
import time
import logging
from .base import BaseClassifier
import scipy.sparse as sp
from ._svm import train_one
from functools import partial
from ..utils import sparse
from ..data import data_loader
from ._svm import train_one, _get_liblinear_solver_ty... | 2.3125 | 2 |
ipgroup_test.py | RyPeck/python-ipgroup | 1 | 10530 | #!/usr/bin/env python3
import ipaddress
import random
import unittest
import ipgroup
class TestGroupIPs(unittest.TestCase):
def setUp(self):
pass
def test_group(self):
IPs = ["127.0.0.1",
"127.0.1.1",
"127.1.1.1",
"127.1.0.1",
"127... | 3.234375 | 3 |
progress.py | PsiLupan/calcprogress | 2 | 10531 | from dataclasses import dataclass
from pickle import FALSE
from dol import Dol
from asm_section_list import AsmSection, AsmSectionType
@dataclass
class Slice:
start: int
end: int
def size(self) -> int:
assert self.end > self.start
return self.end - self.start
def contains_section(self... | 2.5625 | 3 |
main_qm9.py | maxxxzdn/en_flows | 0 | 10532 | <filename>main_qm9.py
import utils
import argparse
import wandb
from os.path import join
from qm9 import dataset
from qm9 import losses
from qm9.models import get_optim, get_model
from flows.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\
assert_correctly_masked
import torch
import time
import pick... | 1.789063 | 2 |
vise/tests/util/test_string.py | kumagai-group/vise | 16 | 10533 | <reponame>kumagai-group/vise<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright (c) 2021. Distributed under the terms of the MIT License.
from vise.util.string import numbers_to_lowercases
def test_numbers_to_lowercases():
assert numbers_to_lowercases("Mg2") == "Mg₂" | 2.46875 | 2 |
code/ch_02_foundations/_02_noneness.py | SuppMonkey/write.pythonic.code | 679 | 10534 | <filename>code/ch_02_foundations/_02_noneness.py<gh_stars>100-1000
def find_accounts(search_text):
# perform search...
if not db_is_available:
return None
# returns a list of account IDs
return db_search(search_text)
accounts = find_accounts('python')
if accounts is None:
print("Error: DB ... | 3.078125 | 3 |
pupa/tests/importers/test_base_importer.py | influence-usa/pupa | 0 | 10535 | <reponame>influence-usa/pupa<filename>pupa/tests/importers/test_base_importer.py
import os
import json
import shutil
import tempfile
import mock
import pytest
from opencivicdata.models import Person
from pupa.scrape import Person as ScrapePerson
from pupa.scrape import Organization as ScrapeOrganization
from pupa.impor... | 2.015625 | 2 |
packaging/bdist_trinoadmin.py | wgzhao/trino-admin | 0 | 10536 | <filename>packaging/bdist_trinoadmin.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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.... | 1.601563 | 2 |
2020-05-month-long-challenge/day22.py | jkbockstael/leetcode | 0 | 10537 | <filename>2020-05-month-long-challenge/day22.py<gh_stars>0
#!/usr/bin/env python3
# Day 22: Sort Characters By Frequency
#
# Given a string, sort it in decreasing order based on the frequency of
# characters.
import collections
class Solution:
def frequencySort(self, s: str) -> str:
return "".join(map(
... | 4.0625 | 4 |
loc.py | relax-space/pandas-first | 0 | 10538 | <gh_stars>0
'''
说明: loc和iloc有几个功能
1. 可以获取一行或者多行数据
2. 可以获取1列或多列数据
3. 可以获取某个单元格的数据
对应dataframe来说, 在不指定index和columns的情况下,iloc和loc一样
区别在于,iloc根据索引下标取值, loc根据索引值取值
'''
import numpy as np
import pandas as pd
def test_1():
# 按行取值
pf = pd.DataFrame([[1, 2], [3, 4]])
iloc_0 = pf.iloc[0]
loc_0 = pf.loc[0]
... | 2.859375 | 3 |
checkproject/runner.py | perror/checkproject | 0 | 10539 | <gh_stars>0
"""Runner to discover, run and collect the results of all the checks."""
def import_module(module_path):
"""Import a Python file as a module in the current context.
@param module_path: Path to the Python file.
@return: A reference to the module once loaded.
"""
import os
import s... | 2.84375 | 3 |
neutron_fwaas/extensions/firewall_v2.py | sapcc/neutron-fwaas | 0 | 10540 | # Copyright (c) 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 1.3125 | 1 |
model_hub/model_hub/mmdetection/utils.py | gh-determined-ai/determined | 0 | 10541 | <filename>model_hub/model_hub/mmdetection/utils.py
"""
Various utility functions for using mmdetection in Determined that may be useful
even if not using the provided MMDetTrial.
build_fp16_loss_scaler is large derived from the original mmcv code at
https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/opti... | 2.21875 | 2 |
gcloud/datastores/tests/STUB_test_bigquery.py | pantheon-ci-bot/etl-framework | 2 | 10542 | <filename>gcloud/datastores/tests/STUB_test_bigquery.py
"""tests bigquery client"""
import unittest
from gcloud.datastores.bigquery import BigqueryClient
class BigqueryClientTestCases(unittest.TestCase):
"""stuff"""
@classmethod
def setUpClass(cls):
cls.project_id = 'test'
cls.dataset_i... | 2.734375 | 3 |
filter_hash.py | mbougarne/python-algos | 0 | 10543 | <gh_stars>0
fruits = ["orange", "banana", "apple", "avocado", "kiwi", "apricot",
"cherry", "grape", "coconut", "lemon", "mango", "peach",
"pear", "strawberry", "pineapple", "apple", "orange", "pear",
"grape", "banana"
]
filters = dict()
for key in fruits:
filters[key] =... | 3 | 3 |
teste/knn.py | joandesonandrade/nebulosa | 0 | 10544 | <filename>teste/knn.py
from sklearn import preprocessing
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#Abrindo o dados como Dataframe
dados = pd.read_csv('dados/001.csv')
#Iniciando o método para binanizar as classe sim=1; não=0
pre = preprocessing.LabelBinarizer()
#Binazirando a classe jo... | 3.28125 | 3 |
components/google-cloud/tests/container/experimental/gcp_launcher/test_batch_prediction_job_remote_runner.py | m-mayran/pipelines | 0 | 10545 | <filename>components/google-cloud/tests/container/experimental/gcp_launcher/test_batch_prediction_job_remote_runner.py
# Copyright 2021 The Kubeflow 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 ... | 1.71875 | 2 |
rotypes/Windows/Storage/Streams/__init__.py | Gliese129/ArknightsAutoHelper | 18 | 10546 | from ctypes import c_uint32, c_void_p, string_at
from rotypes.idldsl import define_winrt_com_method, GUID
from rotypes.inspectable import IInspectable, IUnknown
@GUID('905a0fef-bc53-11df-8c49-001e4fc686da')
class IBufferByteAccess(IUnknown):
pass
@GUID('905A0FE0-BC53-11DF-8C49-001E4FC686DA')
class IBuffer(IIns... | 2.046875 | 2 |
simple_playgrounds/playground.py | Asjidkalam/simple-playgrounds | 0 | 10547 | # -*- coding: utf-8 -*-
""" Playground documentation.
Module defining Playground Base Class
"""
import os
from abc import ABC
import yaml
import pymunk
from .utils import PositionAreaSampler
from .utils.definitions import SPACE_DAMPING, CollisionTypes, SceneElementTypes
# pylint: disable=unused-argument
# pylint:... | 2.8125 | 3 |
UEManifestReader/classes/FManifestData.py | ryryburge/UEManifestReader | 0 | 10548 | <filename>UEManifestReader/classes/FManifestData.py
# -*- coding: utf-8 -*-
import zlib
from UEManifestReader.enums import *
from UEManifestReader.classes.FCustomFields import FCustomFields
from UEManifestReader.classes.FManifestMeta import FManifestMeta
from UEManifestReader.classes.FChunkDataList import FChunkDataLi... | 2.09375 | 2 |
Python/module.py | minjibyeongho/KOSA-Pytorch | 2 | 10549 | <reponame>minjibyeongho/KOSA-Pytorch
#module.py
def hello():
print("Hello!")
#if __name__=="__main__":
# print(__name__) | 1.820313 | 2 |
data_utils.py | algoprog/Quin | 47 | 10550 | import csv
import json
import pickle
import logging
import re
import pandas
import gzip
import os
import numpy as np
from random import randint, random
from tqdm import tqdm
from retriever.dense_retriever import DenseRetriever
from models.tokenization import tokenize
from typing import Union, List
class InputExampl... | 2.484375 | 2 |
hc/accounts/migrations/0025_remove_member_team.py | opsct/healthchecks | 0 | 10551 | <gh_stars>0
# Generated by Django 2.1.5 on 2019-01-22 08:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0024_auto_20190119_1540'),
]
operations = [
migrations.RemoveField(
model_name='member',
name='team'... | 1.28125 | 1 |
openstack-dashboard/openstack_dashboard/api/proxy.py | foruy/openflow-multiopenstack | 1 | 10552 | <filename>openstack-dashboard/openstack_dashboard/api/proxy.py
from django.conf import settings
#from proxyclient.v2 import client as proxy_client
from openstack_dashboard.utils import proxy_client
def proxyclient(request):
management_url = getattr(settings, 'MANAGEMENT_URL')
conn = proxy_client.Client(reque... | 2.03125 | 2 |
tfl_data.py | dongyan1024/overtime | 9 | 10553 | <reponame>dongyan1024/overtime<filename>tfl_data.py<gh_stars>1-10
import overtime as ot
times = ['14:00','14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55']
tfl_data = ot.TflInput(['victoria', 'central', 'bakerloo', 'piccadilly'], ['inbound', 'outbound'], times)
| 2.34375 | 2 |
apps/dc_tools/odc/apps/dc_tools/fs_to_dc.py | opendatacube/odc-tools | 29 | 10554 | <filename>apps/dc_tools/odc/apps/dc_tools/fs_to_dc.py<gh_stars>10-100
import json
from pathlib import Path
import click
import datacube
from datacube.index.hl import Doc2Dataset
from odc.apps.dc_tools.utils import (
index_update_dataset,
update_if_exists,
allow_unsafe,
transform_stac,
)
from ._stac imp... | 2.140625 | 2 |
scripts/fullizer.py | stijm/jazzjackrabbit2 | 5 | 10555 | <gh_stars>1-10
"""
WARNING:
Using this script outside any server except one with IP 127.0.0.1 means risking getting
an instant and permanent ban, anywhere you use it.
The script was created *ONLY FOR LOCAL* testing purposes.
NEVER, NEVER, *NEVER* run it in an online multiplayer server.
At least unless you're a... | 2.171875 | 2 |
setup.py | pranithk/gluster-georep-tools | 0 | 10556 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
gluster-georep-tools.setup.py
:copyright: (c) 2016 by <NAME>
:license: MIT, see LICENSE for more details.
"""
from setuptools import setup
setup(
name="gluster-georep-tools",
version="0.2",
packages=["gluster_georep_tools",
"gluster_georep... | 0.976563 | 1 |
docs/_downloads/dbc5873471dad3c21022112121cbd008/tensorboard_profiler_tutorial.py | woojinsong/PyTorch-tutorials-kr | 221 | 10557 | """
PyTorch Profiler With TensorBoard
====================================
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
to detect performance bottlenecks of the model.
Introduction
------------
PyTorch 1.8 includes an updated profiler API capable of
recording the CPU side operations ... | 2.96875 | 3 |
imgtoch/__init__.py | hrpzcf/imgtoch | 0 | 10558 | # coding: utf-8
from .__utils__ import grayscaleOf, makeImage, sortByGrayscale
NAME = "imgtoch"
VERSIONNUM = 0, 2, 3
VERSION = ".".join(map(str, VERSIONNUM))
AUTHOR = "hrpzcf"
EMAIL = "<EMAIL>"
WEBSITE = "https://gitee.com/hrpzcf/imgtoch"
__all__ = ["grayscaleOf", "makeImage", "sortByGrayscale"]
| 1.617188 | 2 |
packages/gradient_boosting_model/gradient_boosting_model/processing/validation.py | g-nightingale/testing-and-monitoring-ml-deployments | 99 | 10559 | import typing as t
from gradient_boosting_model.config.core import config
import numpy as np
import pandas as pd
from marshmallow import fields, Schema, ValidationError
class HouseDataInputSchema(Schema):
Alley = fields.Str(allow_none=True)
BedroomAbvGr = fields.Integer()
BldgType = fields.Str()
Bsm... | 2.234375 | 2 |
pyplan_engine/classes/IOEngine.py | jorgedouglas71/pyplan-ide | 17 | 10560 |
class IOEngine(object):
def __init__(self, node):
self.node = node
self.inputs = []
self.outputs = []
def release(self):
self.inputs = None
self.outputs = None
self.node = None
def updateInputs(self, names):
# remove prior outputs
for input... | 2.984375 | 3 |
RLBotPack/JoeyBot/CSharpPythonAgent/CSharpPythonAgent.py | RLMarvin/RLBotPack | 13 | 10561 | import os
from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
from rlbot.agents.base_dotnet_agent import BaseDotNetAgent
from rlbot.parsing.custom_config import ConfigHeader, ConfigObject
class DotNetBot(BaseDotNetAgent):
def get_port_file_path(self):
# Look for a port.cfg file in the same direct... | 2.0625 | 2 |
v3_experiments.py | runekaagaard/workflows | 0 | 10562 | <filename>v3_experiments.py<gh_stars>0
# coding=utf-8
import inspect
from functools import wraps
def listify(func_s):
if callable(func_s):
return [func_s]
else:
return func_s
def parse_conditions(condition_s, args, kwargs, title):
err_msg = unicode(title) + u" nr. {} failed: {}"
for ... | 2.5625 | 3 |
externals/binaryen/test/emscripten/tools/distill_asm.py | caokun8008/ckeos | 40 | 10563 | <reponame>caokun8008/ckeos<gh_stars>10-100
'''
Gets the core asm module out of an emscripten output file.
By default it adds a ';' to end the
var asm = ...
statement. You can add a third param to customize that. If the third param is 'swap-in', it will emit code to swap this asm module in, instead of the default o... | 2.09375 | 2 |
apex/contrib/conv_bias_relu/conv_bias_relu.py | XL-Kong/Painter_GAN | 0 | 10564 | import torch
import pdb
from torch.autograd import gradcheck
import fused_conv_bias_relu
class ConvBiasReLU_(torch.autograd.Function):
@staticmethod
@torch.cuda.amp.custom_fwd(cast_inputs=torch.half)
def forward(ctx, x, weight, bias, padding, stride):
outputs = fused_conv_bias_relu.forward([x, wei... | 2.46875 | 2 |
data-structures/trees/trees/trees.py | bayan-alkhatib/data-structures-and-algorithms-401 | 0 | 10565 | class Node:
def __init__(self,value):
self.value=value
self.left=None
self.right=None
class Binary_Tree:
def __init__(self):
self.root = None
def pre_order(self):
""" root-left-right """
try:
self.values=[]
if self.ro... | 4.0625 | 4 |
ironic_inspector/cmd/dbsync.py | namnx228/ironic-inspector | 31 | 10566 | <gh_stars>10-100
# Copyright 2015 Cisco Systems
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 2.109375 | 2 |
trabalhoaqui/comp_perguntas/valida.py | EmanoelG/jogodaforca | 1 | 10567 | from jogo import desenha_jogo
from random import randint
import sys
def input_cria_usuario():
usuario = dict()
usuario['nome'] = input('Informe o seu nome: ')
usuario['pontos'] = 0
usuario['desafiado'] = False
return usuario
def comeco(j1, j2):
j1 = 1
j2 = 2
n= randint(j1,j2)
... | 3.25 | 3 |
DesksReminder/Desks/accounts_desk.py | flopezag/fiware-management-scripts | 0 | 10568 | <reponame>flopezag/fiware-management-scripts
from datetime import date, datetime
from DesksReminder.Basics.dataFinder import Data
from DesksReminder.Basics.nickNames import ContactBook
from Config.settings import JIRA_URL
__author__ = '<NAME>'
class AccountsDesk:
def __init__(self):
self.contactBook = Co... | 2.28125 | 2 |
scripts/ip2hex.py | Kidlike/dotfiles | 0 | 10569 | #!/usr/bin/python
import sys
import re
def iptohex(ip):
octets = ip.split('.')
hex_octets = []
for octet in octets:
if int(octet) < 16:
hex_octets.append('0' + hex(int(octet))[2:])
else:
hex_octets.append(hex(int(oc... | 3.203125 | 3 |
src/models/CVX_weighted.py | DanqingZ/social-DCM | 14 | 10570 | <reponame>DanqingZ/social-DCM
import random
import numpy as np
import numpy.linalg as LA
import scipy as spy
import time
from itertools import *
import sys
import cvxpy as cvx
from random import randint
import numpy as np
import random
from scipy.sparse import csc_matrix
from scipy import sparse as sp
import networkx a... | 2.109375 | 2 |
experiments/colorization_cINN/data.py | jlmaccal/FrEIA | 0 | 10571 | <reponame>jlmaccal/FrEIA
import sys
import glob
from os.path import join
from multiprocessing import Pool
import numpy as np
import matplotlib.pyplot as plt
from skimage import io, color
from PIL import Image, ImageEnhance
import torch
from torch.utils.data import Dataset, DataLoader, TensorDataset
import torch.nn.fun... | 2.3125 | 2 |
utils/editor.py | tien1504/idinvert_pytorch | 415 | 10572 | <reponame>tien1504/idinvert_pytorch
# python 3.7
"""Utility functions for image editing from latent space."""
import os.path
import numpy as np
__all__ = [
'parse_indices', 'interpolate', 'mix_style',
'get_layerwise_manipulation_strength', 'manipulate', 'parse_boundary_list'
]
def parse_indices(obj, min_val... | 3.078125 | 3 |
venv/lib/python3.8/site-packages/pyls/_version.py | Retraces/UkraineBot | 2 | 10573 | /home/runner/.cache/pip/pool/24/e8/39/183700a0b2d2a9545f3da2571d82b53df290aab3a51dc229b113d16e6c | 0.65625 | 1 |
pymoo/util/normalization.py | Electr0phile/pymoo | 1 | 10574 | import numpy as np
def denormalize(x, x_min, x_max):
if x_max is None:
_range = 1
else:
_range = (x_max - x_min)
return x * _range + x_min
def normalize(x, x_min=None, x_max=None, return_bounds=False, estimate_bounds_if_none=True):
# if the bounds should be estimated if none do it... | 3.5625 | 4 |
alembic/versions/92235b77ea53_check_new.py | go-lab/appcomposer | 1 | 10575 | """Check new
Revision ID: 92235b77ea53
Revises: 381fdb66ec27
Create Date: 2017-10-14 02:38:51.007307
"""
# revision identifiers, used by Alembic.
revision = '92235b77ea53'
down_revision = '381fdb66ec27'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - pl... | 1.414063 | 1 |
build/lib/adb_utils/adb_utils.py | christopherferreira3/Python-ADB-Tools | 0 | 10576 | <reponame>christopherferreira3/Python-ADB-Tools
import subprocess
import os
def get_connected_devices() -> list:
"""
Returns a list of tuples containing the Device name and the android Version
:return:
"""
devices = []
devices_output = subprocess.check_output(["adb", "devices"]).decode("utf-8"... | 3.203125 | 3 |
tests/unit/test_cl61d.py | griesche/cloudnetpy-1 | 1 | 10577 | import glob
import os
import sys
from tempfile import TemporaryDirectory
import netCDF4
import numpy as np
import numpy.ma as ma
from all_products_fun import Check
from lidar_fun import LidarFun
from cloudnetpy import concat_lib
from cloudnetpy.instruments import ceilo2nc
SCRIPT_PATH = os.path.dirname(os.path.realpa... | 2.1875 | 2 |
tests/functions/test_count.py | athre0z/clickhouse-sqlalchemy | 1 | 10578 | <reponame>athre0z/clickhouse-sqlalchemy<filename>tests/functions/test_count.py
from sqlalchemy import Column, func
from clickhouse_sqlalchemy import types, Table
from tests.testcase import (
BaseAbstractTestCase, HttpSessionTestCase, NativeSessionTestCase,
)
class CountTestCaseBase(BaseAbstractTestCase):
def... | 2.5625 | 3 |
scripts/commands/html/actions/search.py | stevekineeve88/orb | 0 | 10579 | import click
import requests
from bs4 import BeautifulSoup
from modules.Word.managers.DictionaryManager import DictionaryManager
import re
@click.command()
@click.option('--url', help='URL to fetch from')
@click.pass_context
def search(ctx, url):
dictionary_manager: DictionaryManager = ctx.obj[DictionaryManager]
... | 3.03125 | 3 |
asf_search/constants/DATASET/__init__.py | jhkennedy/Discovery-asf_search | 0 | 10580 | """Datasets to be used in search and related functions"""
from .DATASET import * | 1.007813 | 1 |
cell2cell/plotting/cci_plot.py | ckmah/cell2cell | 16 | 10581 | # -*- coding: utf-8 -*-
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from cell2cell.clustering import compute_linkage
from cell2cell.preprocessing.manipulate_dataframes import check_symmetry
from cell2cell.plotting.aesthetics import map_col... | 2.625 | 3 |
var/spack/repos/builtin.mock/packages/gnuconfig/package.py | jeanbez/spack | 0 | 10582 | <reponame>jeanbez/spack
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
class Gnuconfig(Package):
"""
The GNU config.gues... | 2 | 2 |
mp4box/parsing/ctts.py | abhijeetbhagat/mp4box | 7 | 10583 | <filename>mp4box/parsing/ctts.py
from mp4box.box import CompositionTimeToSampleBox
def parse_ctts(reader, my_size):
version = reader.read32()
box = CompositionTimeToSampleBox(my_size, version, 0)
box.entry_count = reader.read32()
for _ in range(0, box.entry_count):
box.sample_count.app... | 2.53125 | 3 |
MsLightweaverManager.py | Goobley/MsLightweaver | 0 | 10584 | <filename>MsLightweaverManager.py
import pickle
import numpy as np
import matplotlib.pyplot as plt
from lightweaver.rh_atoms import H_6_atom, C_atom, O_atom, OI_ord_atom, Si_atom, Al_atom, Fe_atom, FeI_atom, MgII_atom, N_atom, Na_atom, S_atom, CaII_atom
from lightweaver.atmosphere import Atmosphere, ScaleType
from ligh... | 1.570313 | 2 |
common/writeExcel.py | lixiaofeng1993/DjangoBlog | 0 | 10585 | <filename>common/writeExcel.py
# coding:utf-8
from openpyxl import load_workbook
import openpyxl
from openpyxl.styles import Font, colors
def copy_excel(cese_path, report_path):
"""
复制测试用例到report_path
:param cese_path:
:param report_path:
:return:
"""
wb2 = openpyxl.Workbook()
wb2.save... | 3.15625 | 3 |
test/cts/tool/CTSConverter/src/nn/specs/V1_1/depthwise_conv2d_float_weights_as_inputs_relaxed.mod.py | zhaoming0/webml-polyfill | 255 | 10586 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | 2 | 2 |
jina/executors/evaluators/rank/recall.py | sdsd0101/jina | 2 | 10587 | from typing import Sequence, Any
from jina.executors.evaluators.rank import BaseRankingEvaluator
from jina.executors.evaluators.decorators import as_aggregator
class RecallEvaluator(BaseRankingEvaluator):
"""A :class:`RecallEvaluator` evaluates the Precision of the search.
It computes how many of the firs... | 2.5625 | 3 |
tests/schema_mapping/structures/example5.py | danny-vayu/typedpy | 0 | 10588 | <reponame>danny-vayu/typedpy
from typedpy import Array, DoNotSerialize, Structure, mappers
class Foo(Structure):
i: int
s: str
_serialization_mapper = {"i": "j", "s": "name"}
class Example5(Foo):
a: Array
_serialization_mapper = [{"j": DoNotSerialize}, mappers.TO_LOWERCASE] | 2.671875 | 3 |
src/semantic_parsing_with_constrained_lm/eval.py | microsoft/semantic_parsing_with_constrained_lm | 17 | 10589 | <filename>src/semantic_parsing_with_constrained_lm/eval.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import dataclasses
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Generic, List, Optional, Sequence, TypeVar
from semantic_parsing_with_co... | 2.390625 | 2 |
irrigation_control/irrigation_control_py3/common_irrigation_chains_py3.py | bopopescu/docker_images_a | 2 | 10590 | <reponame>bopopescu/docker_images_a
class Check_Excessive_Current(object):
def __init__(self,chain_name,cf,handlers,irrigation_io,irrigation_hash_control,get_json_object):
self.get_json_object = get_json_object
cf.define_chain(chain_name, False )
#cf.insert.log("check_excessive_c... | 2.203125 | 2 |
lib/surface/spanner/operations/list.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | 10591 | # -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 1.664063 | 2 |
pgmpy/tests/test_models/test_SEM.py | predictive-analytics-lab/pgmpy | 0 | 10592 | <filename>pgmpy/tests/test_models/test_SEM.py
import os
import unittest
import numpy as np
import networkx as nx
import numpy.testing as npt
from pgmpy.models import SEM, SEMGraph, SEMAlg
class TestSEM(unittest.TestCase):
def test_from_graph(self):
self.demo = SEM.from_graph(
ebunch=[
... | 2.484375 | 2 |
data_scripts/translation.py | wangcongcong123/transection | 4 | 10593 | # coding=utf-8
# This script is finished following HF's datasets' template:
# https://github.com/huggingface/datasets/blob/master/templates/new_dataset_script.py
# More examples as references to write a customized dataset can be found here:
# https://github.com/huggingface/datasets/tree/master/datasets
from __future__... | 2.875 | 3 |
utils/chat_formatting.py | lyricalpaws/snekbot | 13 | 10594 | import itertools
from typing import Sequence, Iterator
# Source: https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/utils/chat_formatting.py
def error(text: str) -> str:
"""Get text prefixed with an error emoji.
Returns
-------
str
The new message.
"""
return "... | 3.4375 | 3 |
strategy/trade/strategymargintrade.py | firebird631/siis | 0 | 10595 | # @date 2018-12-28
# @author <NAME>, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# Strategy trade for margin with multiples positions.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Tuple
if TYPE_CHECKING:
from trader.trader import Trader
... | 2.421875 | 2 |
src/pyramid_debugtoolbar_api_sqlalchemy/__init__.py | jvanasco/pyramid_debugtoolbar_api_sqla | 0 | 10596 | <gh_stars>0
# local
from .panels import SqlalchemyCsvDebugPanel
__VERSION__ = "0.3.1"
# ==============================================================================
def includeme(config):
"""
Pyramid hook to install this debugtoolbar plugin.
Update your ENVIRONMENT.ini file
debugtoolbar.in... | 2.015625 | 2 |
ultron/utilities/zlib_engine.py | wangjiehui11235/ultron | 4 | 10597 | <filename>ultron/utilities/zlib_engine.py
# -*- coding: utf-8 -*-
import os,os.path
import zipfile
def zip_compress(dir_name, zip_filename):
filelist = []
if os.path.isfile(dir_name):
filelist.append(dir_name)
else :
for root, dirs, files in os.walk(dir_name):
for name in files... | 2.8125 | 3 |
scripts/instances2inventory.py | TipaZloy/coda-automation | 0 | 10598 | <gh_stars>0
#!/usr/bin/env python3
import boto
import boto.ec2
import sys
from pprint import pprint
from collections import defaultdict
output = defaultdict(lambda: [])
comments = defaultdict(lambda: {})
skip_region_strings = ['us-gov', 'cn-', 'ca-']
#skip_region_strings = ['us-gov', 'cn-', 'ca-', 'eu-', 'ap-']
if... | 2.625 | 3 |
selfdrive/crash.py | darknight111/openpilot3 | 19 | 10599 | """Install exception handler for process crash."""
from selfdrive.swaglog import cloudlog
from selfdrive.version import version
import sentry_sdk
from sentry_sdk.integrations.threading import ThreadingIntegration
def capture_exception(*args, **kwargs) -> None:
cloudlog.error("crash", exc_info=kwargs.get('exc_info',... | 2.046875 | 2 |