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 |
|---|---|---|---|---|---|---|
mflops/model_info.py | shuncyu/mflops | 1 | 4800 | <reponame>shuncyu/mflops
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 14 17:38:48 2020
@author: luke
"""
import sys
from functools import partial
import torch
import torch.nn as nn
import prettytable as pt
from .basic_hook import MODULES_MAPPING
def get_model_compute_info(model, input_res,... | 1.601563 | 2 |
dosagelib/plugins/derideal.py | Church-/dosage | 1 | 4801 | # SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 <NAME>
# Copyright (C) 2019-2020 <NAME>
from ..scraper import _ParserScraper
from ..helpers import indirectStarter
class Derideal(_ParserScraper):
baseUrl = 'https://www.derideal.com/'
imageSearch = '//img[contains(@class, "comic-page")]'
prevSearch... | 2.578125 | 3 |
LearnFunction/learnfunction01.py | subash-kc/2022-01-04-Python | 1 | 4802 | <reponame>subash-kc/2022-01-04-Python
"""
Function are subprograms which are used to compute a value or perform a task.
Type of Functions:-
Built in Functions:
print(), upper()
User define functions
Advantage of Functions
1. Write once and use it as many time as you need. This provides code reusability
2. F... | 4.03125 | 4 |
trackr/cli.py | rpedigoni/trackr | 9 | 4803 | # coding: utf-8
import click
@click.command()
@click.option('--carrier', prompt='Carrier ID', help='Example: "ect" for Correios')
@click.option('--object-id', prompt='Object ID',
help='Example: PN871429404BR')
def main(carrier, object_id):
from trackr import Trackr
from trackr.exceptions import ... | 2.53125 | 3 |
pitop/common/notifications.py | pi-top/pi-top-Python-SDK | 28 | 4804 | <filename>pitop/common/notifications.py
from enum import Enum, auto
from subprocess import CalledProcessError, run
from pitop.common.command_runner import run_command
from pitop.common.logger import PTLogger
class NotificationAction:
def __init__(self, call_to_action_text, command_str) -> None:
self.call... | 2.3125 | 2 |
src/Gismo_XY To Location.py | AntonelloDN/gismo | 57 | 4805 | # xy to location
#
# Gismo is a plugin for GIS environmental analysis (GPL) started by <NAME>.
#
# This file is part of Gismo.
#
# Copyright (c) 2019, <NAME> <<EMAIL>>
# Gismo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Sof... | 2.5 | 2 |
Notebooks/SentinelUtilities/SentinelAnomalyLookup/__init__.py | ytognder/Azure-Sentinel | 266 | 4806 | # pylint: disable-msg=C0103
"""
SentinelAnomalyLookup: This package is developed for Azure Sentinel Anomaly lookup
"""
# __init__.py
from .anomaly_lookup_view_helper import AnomalyLookupViewHelper
from .anomaly_finder import AnomalyQueries, AnomalyFinder
| 1.21875 | 1 |
items/coins.py | leerichoang/Legend-Of-Peach | 0 | 4807 | <reponame>leerichoang/Legend-Of-Peach<filename>items/coins.py
import pygame
from pygame.sprite import Sprite
class Coins(Sprite):
"""Coins"""
def __init__(self, hub, x, y, name='coin', state='floating'):
super().__init__()
# Values
self.name = name
self.hub = hub
self.o... | 3.28125 | 3 |
python/package/geo/test/__init__.py | fiomenankiti/playground | 0 | 4808 | from geo.calc import Calc
from geo.calc import Distance
from geo.geosp import Wt
from geo.geosp import Gh
from geo.files.csv_file import check | 1.15625 | 1 |
tests/test_clean.py | tcapelle/nb_helpers | 7 | 4809 | <gh_stars>1-10
from pathlib import Path
from nb_helpers.clean import clean_all, clean_one
from tests import TEST_PATH
TEST_PATH
TEST_NB = Path("test_nb.py")
def test_clean_one():
"clean just one nb"
clean_one(TEST_NB)
def test_clean_all():
"clean all test nbs"
clean_all(path=TEST_PATH)
| 1.960938 | 2 |
apps/technical_analysis.py | KiloSat/FirstNivesh | 0 | 4810 | <filename>apps/technical_analysis.py
import streamlit as st
def app():
import yfinance as yf
import streamlit as st
import datetime
import matplotlib.pyplot as plt
import talib
import ta
import numpy as np
import matplotlib.ticker as mticker
import pandas as pd
import requests... | 3.125 | 3 |
tests/sentry/mediators/sentry_apps/test_creator.py | pombredanne/django-sentry | 0 | 4811 | <reponame>pombredanne/django-sentry
from __future__ import absolute_import
from mock import patch
from django.db import IntegrityError
from sentry.mediators.sentry_apps import Creator
from sentry.models import (
AuditLogEntry,
AuditLogEntryEvent,
ApiApplication,
IntegrationFeature,
SentryApp,
... | 1.976563 | 2 |
python/Model_Files/LFV_3/parameters.py | ZAKI1905/HEP-Phen | 1 | 4812 | # This file was automatically created by FeynRules 2.3.32
# Mathematica version: 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)
# Date: Sat 21 Apr 2018 20:48:39
from object_library import all_parameters, Parameter
from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot
# This is a defau... | 1.71875 | 2 |
musicLrc.py | xiangxing98/Rhythm-Enlightment | 0 | 4813 | <gh_stars>0
import time
musicLrc = """
[00:03.50]传奇
[00:19.10]作词:刘兵 作曲:李健
[00:20.60]演唱:王菲
[00:26.60]
[04:40.75][02:39.90][00:36.25]只是因为在人群中多看了你一眼
[04:49.00]
[02:47.44][00:43.69]再也没能忘掉你容颜
[02:54.83][00:51.24]梦想着偶然能有一天再相见
[03:02.32][00:58.75]从此我开始孤单思念
[03:08.15][01:04.30]
[03:09.35][01:05.50]想你时你在天边
[03:16.90][01:13.13]... | 1.890625 | 2 |
octoprint_octopod/__init__.py | mnebelung/OctoPrint-OctoPod | 52 | 4814 | <reponame>mnebelung/OctoPrint-OctoPod
# coding=utf-8
from __future__ import absolute_import
import datetime
import logging
import sys
import flask
import octoprint.plugin
from octoprint.events import eventManager, Events
from octoprint.server import user_permission
from octoprint.util import RepeatedTimer
from .bed_... | 1.789063 | 2 |
tests/test_buffers.py | romanchyla/CSPatterns | 0 | 4815 | from cspatterns.datastructures import buffer
def test_circular_buffer():
b = buffer.CircularBuffer(2, ['n'])
assert len(b.next) == 2
assert b.n is None
b = buffer.CircularBuffer.create(2, attrs=['n', 'fib'])
curr = b
out = [0, 1, ]
curr.prev[-2].n = 0
curr.prev[-2].fib = 1
curr... | 3.0625 | 3 |
plugins/redacted/migrations/0001_initial.py | 2600box/harvest | 9 | 4816 | # Generated by Django 2.1.7 on 2019-02-17 14:50
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RedactedClientConfig',
fields=[
('id', mode... | 1.90625 | 2 |
code_examples/plotting_data/hexbin.py | ezcitron/BasemapTutorial | 99 | 4817 | from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from numpy import array
from numpy import max
map = Basemap(llcrnrlon=-0.5,llcrnrlat=39.8,urcrnrlon=4.,urcrnrlat=43.,
resolution='i', projection='tmerc', lat_0 = 39.5, lon_0 = 1)
map.readshapefil... | 2.140625 | 2 |
src/plugins/sjsy.py | 2443391447/nonebot2 | 1 | 4818 | <filename>src/plugins/sjsy.py
from nonebot import on_keyword, on_command
from nonebot.typing import T_State
from nonebot.adapters.cqhttp import Message, Bot, Event # 这两个没用的别删
from nonebot.adapters.cqhttp.message import MessageSegment
import requests
from nonebot.permission import *
from nonebot.rule import to_me... | 2.203125 | 2 |
src/extractors/emojiextractor.py | chmduquesne/rofimoji | 574 | 4819 | import html
from collections import namedtuple
from pathlib import Path
from typing import List, Dict
import requests
from bs4 import BeautifulSoup
from lxml import etree
from lxml.etree import XPath
Emoji = namedtuple('Emoji', 'char name')
class EmojiExtractor(object):
def __init__(self):
self.all_emo... | 2.875 | 3 |
tests/integration_tests/security/test_seccomp.py | gregbdunn/firecracker | 2 | 4820 | <filename>tests/integration_tests/security/test_seccomp.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests that the seccomp filters don't let blacklisted syscalls through."""
import os
from subprocess import run
import pytest
import host_tools... | 2 | 2 |
cluster/density/test.py | michealowen/MachingLearning | 2 | 4821 | <filename>cluster/density/test.py
class a:
def __init__(self,da):
self.da = da
return
def go(self):
dd()
return None
def dd():
print('ok')
return None
aa = a(1)
aa.go() | 2.109375 | 2 |
REM/Tool/IDA 7.3/python/ida_hexrays.py | dodieboy/Np_class | 0 | 4822 | <reponame>dodieboy/Np_class<gh_stars>0
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
IDA Plugin SDK API wrapper: hexrays
"""
from sys import version_info... | 2.015625 | 2 |
webapp/gen_graphs.py | bfitzy2142/NET4901-SP | 3 | 4823 | #!/usr/bin/env python3
"""
@author: <NAME>
MySql Parser for graphical presentation
"""
import mysql.connector
import datetime
from mysql.connector import Error
from datetime import datetime, timedelta
import json
class sql_graph_info():
def __init__(self, node, interface, time, sql_creds, db):
"""
... | 3.0625 | 3 |
scqubits/tests/test_fluxqubit.py | dmtvanzanten/scqubits | 0 | 4824 | # test_fluxqubit.py
# meant to be run with 'pytest'
#
# This file is part of scqubits.
#
# Copyright (c) 2019 and later, <NAME> and <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
##############... | 1.890625 | 2 |
PhysicsTools/PatAlgos/python/producersLayer1/pfParticleProducer_cfi.py | ckamtsikis/cmssw | 852 | 4825 | <filename>PhysicsTools/PatAlgos/python/producersLayer1/pfParticleProducer_cfi.py
import FWCore.ParameterSet.Config as cms
patPFParticles = cms.EDProducer("PATPFParticleProducer",
# General configurables
pfCandidateSource = cms.InputTag("noJet"),
# MC matching configurables
addGenMatch = cms.bool(False... | 1.921875 | 2 |
tests/test_api.py | ines/spacy-js | 141 | 4826 | <filename>tests/test_api.py
# coding: utf8
from __future__ import unicode_literals
import pytest
import spacy
import json
from api.server import parse, doc2json, load_model
@pytest.fixture(scope="session")
def model():
return "en_core_web_sm"
@pytest.fixture(scope="session")
def text():
return "This is a ... | 2.421875 | 2 |
python/GafferArnold/ArnoldTextureBake.py | medubelko/gaffer | 1 | 4827 | <reponame>medubelko/gaffer
##########################################################################
#
# Copyright (c) 2018, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
#... | 1.023438 | 1 |
aea/protocols/generator/common.py | valory-xyz/agents-aea | 0 | 4828 | <filename>aea/protocols/generator/common.py
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... | 1.6875 | 2 |
tests/unit/python/foglamp/services/core/api/test_backup_restore.py | vaibhav-ScaleDB/FogLAMP | 0 | 4829 | # -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import os
import asyncio
import json
from unittest.mock import MagicMock, patch
from collections import Counter
from aiohttp import web
import pytest
from foglamp.services.core import routes
from foglamp.services.core import ... | 1.96875 | 2 |
pyemits/core/preprocessing/dimensional_reduction.py | thompson0012/PyEmits | 6 | 4830 | <reponame>thompson0012/PyEmits<gh_stars>1-10
"""
Why need dimensional reduction
The following is the use of dimensionality reduction in the data set:
• As data dimensions continue to decrease, the space required for data storage will also decrease.
• Low-dimensional data helps reduce calculation/training time.
• Some ... | 4.21875 | 4 |
sample_project/exam/exam.py | pcse/gitlab_tools | 0 | 4831 | <gh_stars>0
"""
These methods can be called inside WebCAT to determine which tests are loaded
for a given section/exam pair. This allows a common WebCAT submission site to
support different project tests
"""
def section():
# Instructor section (instructor to change before distribution)
#return 8527
#retur... | 2.015625 | 2 |
scrapy/clarinetear/spiders/pagina12.py | ramiror/clarinete | 0 | 4832 | <reponame>ramiror/clarinete<gh_stars>0
from datetime import datetime
import scrapy
import lxml
from lxml.html.clean import Cleaner
import re
SOURCE = 'Página 12'
LANGUAGE = 'es'
cleaner = Cleaner(allow_tags=['p', 'br', 'b', 'a', 'strong', 'i', 'em'])
class Pagina12Spider(scrapy.Spider):
name = 'pagina12'
allo... | 2.546875 | 3 |
svd.py | christyc14/fyp | 0 | 4833 | from calendar import c
from typing import Dict, List, Union
from zlib import DEF_BUF_SIZE
import json_lines
import numpy as np
import re
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler
import pandas as pd
import json
from scipy.spa... | 2.203125 | 2 |
esp32/tools/flasher.py | rodgergr/pycom-micropython-sigfox | 0 | 4834 | #!/usr/bin/env python
#
# Copyright (c) 2018, Pycom Limited.
#
# This software is licensed under the GNU GPL version 3 or any
# later version, with permitted additional terms. For more information
# see the Pycom Licence v1.0 document supplied with this file, or
# available at https://www.pycom.io/opensource/licensing
... | 2.4375 | 2 |
hknweb/events/tests/models/utils.py | jyxzhang/hknweb | 0 | 4835 | import datetime
from django.utils import timezone
from django.contrib.auth.models import User
from hknweb.events.models import Event, EventType, Rsvp
class ModelFactory:
@staticmethod
def create_user(**kwargs):
default_kwargs = {
"username": "default username",
}
kwargs =... | 2.34375 | 2 |
HealthNet/prescriptions/views.py | jimga150/HealthNet | 0 | 4836 | <filename>HealthNet/prescriptions/views.py
from django.shortcuts import redirect
from .forms import PrescriptionForm
from core.views import is_doctor, is_nurse, is_admin, is_patient
from core.models import *
from .models import Prescription
from django.contrib.auth.decorators import login_required, user_passes_test... | 2.390625 | 2 |
algorithms/329. Longest Increasing Path in a Matrix.py | woozway/py3-leetcode | 1 | 4837 | """
1. Clarification
2. Possible solutions
- dfs + memoization
- Topological sort
3. Coding
4. Tests
"""
# T=O(m*n), S=O(m*n)
from functools import lru_cache
class Solution:
DIRS = [(-1, 0), (1, 0), (0, -1), (0, 1)]
def longestIncreasingPath(self, matrix: List[List[int]]) -> int:
if not mat... | 3.28125 | 3 |
cocos2d/tools/coding-style/tailing-spaces.py | NIKEA-SOFT/TestGame | 898 | 4838 | #!/usr/bin/env python
#coding=utf-8
'''
Remove tailing whitespaces and ensures one and only one empty ending line.
'''
import os, re
def scan(*dirs, **kwargs):
files = []
extensions = kwargs['extensions'] if kwargs.has_key('extensions') else None
excludes = kwargs['excludes'] if kwargs.has_key('excludes') else... | 2.796875 | 3 |
three.py/TestPostprocessing-8Bit.py | Michael-Pascale/three.py | 0 | 4839 | from core import *
from cameras import *
from geometry import *
from material import *
from lights import *
class TestPostprocessing2(Base):
def initialize(self):
self.setWindowTitle('Pixellation and Reduced Color Palette')
self.setWindowSize(1024,768)
self.renderer = Rendere... | 2.234375 | 2 |
scripts/test_cache_size_vs_code_balance.py | tareqmalas/girih | 7 | 4840 | <filename>scripts/test_cache_size_vs_code_balance.py
#!/usr/bin/env python
def igs_test(target_dir, exp_name, th, group='', dry_run=0):
from scripts.conf.conf import machine_conf, machine_info
from scripts.utils import run_test
import itertools
cs = 8192
th = th
# Test using rasonable time
# T = scale... | 1.734375 | 2 |
generate/lib/run-firefox/firefox_runner.py | flamencist/browser-extensions | 102 | 4841 | <reponame>flamencist/browser-extensions
import os
import shutil
import codecs
import json
from cuddlefish.runner import run_app
from cuddlefish.rdf import RDFManifest
def run():
original_harness_options = os.path.join('development', 'firefox', 'harness-options.json')
backup_harness_options = os.path.join('developme... | 1.703125 | 2 |
pyripple/protocol/orderbook.py | gip/pyripple | 0 | 4842 | # PyRipple
#
# Copyright 2015 <NAME>
#
# 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 wr... | 2.234375 | 2 |
myvenv/lib/python3.6/site-packages/nltk/test/unit/test_senna.py | catb0y/twitter_feeling | 69 | 4843 | # -*- coding: utf-8 -*-
"""
Unit tests for Senna
"""
from __future__ import unicode_literals
from os import environ, path, sep
import logging
import unittest
from nltk.classify import Senna
from nltk.tag import SennaTagger, SennaChunkTagger, SennaNERTagger
# Set Senna executable path for tests if it is not specifie... | 2.59375 | 3 |
eoxserver/services/opensearch/v11/description.py | kalxas/eoxserver | 25 | 4844 | #-------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: <NAME> <<EMAIL>>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2015 EOX IT Services GmbH
#
# Permission is hereby granted, free o... | 1.328125 | 1 |
exercises/level_0/stringing.py | eliranM98/python_course | 6 | 4845 | <reponame>eliranM98/python_course
text = '''
<NAME>'s ({}) tale of injustice, heroism and love follows the fortunes of <NAME>, an escaped convict determined to put his criminal past behind him. But his attempts to become a respected member of the community are constantly put under threat: by his own conscience, when, o... | 4.125 | 4 |
lab1/text_recognizer/models/mlp.py | Agyey/fsdl-text-recognizer-2021-labs | 0 | 4846 | <gh_stars>0
from typing import Any, Dict
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
FC1_DIM = 1024
FC2_DIM = 128
class MLP(nn.Module):
"""Simple MLP suitable for recognizing single characters."""
def __init__(
self,
data_config: Dic... | 2.578125 | 3 |
frontend/widgets/button.py | AzoeDesarrollos/PyMavisDatabase | 0 | 4847 | from pygame import Surface, font
from .basewidget import BaseWidget
from frontend import Renderer, WidgetHandler
class Button(BaseWidget):
action = None
def __init__(self, x, y, texto, action=None):
self.f = font.SysFont('Verdana', 16)
imagen = self.crear(texto)
rect = imagen.get_rect... | 2.921875 | 3 |
tensorflow_rnn/mnist_lstm.py | naoki009/samples | 0 | 4848 | <filename>tensorflow_rnn/mnist_lstm.py<gh_stars>0
import numpy as np
import tensorflow as tf
"""
Do an MNIST classification line by line by LSTM
"""
(x_train, y_train), \
(x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train, x_test = x_train/255.0, x_test/255.0
model = tf.keras.Sequential()
model.add(t... | 3.015625 | 3 |
scrap/CloudCoverUndersampling.py | cseale/kaggle-amazon-rainforests | 0 | 4849 | <filename>scrap/CloudCoverUndersampling.py<gh_stars>0
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import os
from random import shuffle
from tqdm import tqdm
DATA_DIR = '../input/amazon/'
TRAIN_TIF_DIR = DATA_DIR + 'train-tif/'
TRAIN_CSV = DATA_DIR + 'train.csv'
TEST_TIF_DIR = DATA_DIR + 'test-ti... | 2.5625 | 3 |
rpython/translator/platform/posix.py | wdv4758h/mu-client-pypy | 0 | 4850 | """Base support for POSIX-like platforms."""
import py, os, sys
from rpython.translator.platform import Platform, log, _run_subprocess
import rpython
rpydir = str(py.path.local(rpython.__file__).join('..'))
class BasePosix(Platform):
exe_ext = ''
make_cmd = 'make'
relevant_environ = ('CPATH', 'LIBRARY_... | 2.140625 | 2 |
chintai-scrape/A001_parse_htmls.py | GINK03/itmedia-scraping | 16 | 4851 | import glob
import bs4
import gzip
import pickle
import re
import os
from concurrent.futures import ProcessPoolExecutor as PPE
import json
from pathlib import Path
from hashlib import sha256
import shutil
Path('json').mkdir(exist_ok=True)
def sanitize(text):
text = re.sub(r'(\t|\n|\r)', '', text)
text = re.s... | 2.390625 | 2 |
google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/scrape/metadata_scraper.py | ricardolsmendes/datacatalog-connectors-hive | 19 | 4852 | <filename>google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/scrape/metadata_scraper.py
#!/usr/bin/python
#
# Copyright 2020 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 o... | 1.929688 | 2 |
aviary/roost/data.py | sxie22/aviary | 0 | 4853 | import functools
import json
from os.path import abspath, dirname, exists, join
from typing import Dict, Sequence
import numpy as np
import pandas as pd
import torch
from pymatgen.core import Composition
from torch.utils.data import Dataset
class CompositionData(Dataset):
def __init__(
self,
df: ... | 2.6875 | 3 |
tests/test_util.py | danqing/dqpy | 0 | 4854 | import unittest
from dq import util
class TestUtil(unittest.TestCase):
def test_safe_cast(self):
assert util.safe_cast('1', int) == 1
assert util.safe_cast('meow', int, 2) == 2
| 3.046875 | 3 |
check_perm.py | codecakes/random_games | 0 | 4855 | <reponame>codecakes/random_games
"""
PermCheck
Check whether array A is a permutation.
https://codility.com/demo/results/demoANZ7M2-GFU/
Task description
A non-empty zero-indexed array A consisting of N integers is given.
A permutation is a sequence containing each element from 1 to N once, and only once.
For example... | 3.71875 | 4 |
src/oci/log_analytics/models/log_analytics_association.py | Manny27nyc/oci-python-sdk | 249 | 4856 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 2.09375 | 2 |
symblic_game/NEW_GAME.py | zishanqin/Symbolic-transfer | 3 | 4857 | <reponame>zishanqin/Symbolic-transfer
'Author: <NAME>'
'''email: <EMAIL>'''
# -------------------------------------------------------------------------------------------------- #
# This code can run 4 different models of Reinforcement Learning:
# Q-Learning (QL), DQN, SRL (DSRL), SRL+CS(DSRL_object_near) and some o... | 1.9375 | 2 |
utils/scene_bounding_box.py | davidemarelli/sfm_flow | 8 | 4858 |
import logging
from typing import Tuple
import bpy
from mathutils import Vector
from .object import get_objs
logger = logging.getLogger(__name__)
class SceneBoundingBox():
"""Scene bounding box, build a bounding box that includes all objects except the excluded ones."""
##################################... | 2.9375 | 3 |
tensor2tensor/trax/rlax/ppo.py | funtion/tensor2tensor | 1 | 4859 | # coding=utf-8
# Copyright 2019 The Tensor2Tensor 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
#
# Unless required by applicable... | 2.1875 | 2 |
models/cal.py | SudoRmFr/The-Nature-Conservancy-Fisheries-Monitoring | 0 | 4860 | <reponame>SudoRmFr/The-Nature-Conservancy-Fisheries-Monitoring
"""
WS-DAN models
<NAME> al.,
"See Better Before Looking Closer: Weakly Supervised Data Augmentation Network for Fine-Grained Visual Classification",
arXiv:1901.09891
"""
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.f... | 2.296875 | 2 |
tests/walls/analytic/plates.py | noabauma/Mirheo | 0 | 4861 | #!/usr/bin/env python
import mirheo as mir
dt = 0.001
ranks = (1, 1, 1)
domain = (8, 16, 8)
force = (1.0, 0, 0)
density = 4
u = mir.Mirheo(ranks, domain, dt, debug_level=3, log_filename='log', no_splash=True)
pv = mir.ParticleVectors.ParticleVector('pv', mass = 1)
ic = mir.InitialConditions.Uniform(number_densit... | 1.921875 | 2 |
scraper-code/myanimelist/base.py | XueAlfred/MALAnalysis | 15 | 4862 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import abc
import bs4
import functools
import utilities
class Error(Exception):
"""Base exception class that takes a message to display upon raising.
"""
def __init__(self, message=None):
"""Creates an instance of Error.
:type message: str
:param message: A... | 3.25 | 3 |
p2/core/http.py | BeryJu/p2 | 0 | 4863 | """p2 core http responses"""
from wsgiref.util import FileWrapper
from django.http import StreamingHttpResponse
from p2.core.constants import ATTR_BLOB_MIME, ATTR_BLOB_SIZE_BYTES
from p2.core.models import Blob
class BlobResponse(StreamingHttpResponse):
"""Directly return blob's content. Optionally return as at... | 2.75 | 3 |
lattedb/project/formfac/migrations/0009_auto_20200528_0907.py | callat-qcd/lattedb | 1 | 4864 | <filename>lattedb/project/formfac/migrations/0009_auto_20200528_0907.py
# Generated by Django 3.0.6 on 2020-05-28 09:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_... | 1.578125 | 2 |
SIO_Code/SIO_coherence.py | mmstoll/Ocean569_Code | 0 | 4865 | """
Data: Temperature and Salinity time series from SIO Scripps Pier
Salinity: measured in PSU at the surface (~0.5m) and at depth (~5m)
Temp: measured in degrees C at the surface (~0.5m) and at depth (~5m)
- Timestamp included beginning in 1990
"""
# imports
import sys,os
import pandas as pd
import numpy as... | 2.515625 | 3 |
abfs/group_data_split.py | rcdilorenzo/abfs | 7 | 4866 | <gh_stars>1-10
from collections import namedtuple as Struct
from sklearn.model_selection import GroupShuffleSplit, ShuffleSplit
DataSplitConfig = Struct('DataSplitConfig', ['validation_size', 'test_size', 'random_seed'])
DEFAULT_SPLIT_CONFIG = DataSplitConfig(0.2, 0.2, 1337)
class GroupDataSplit():
def __init__(... | 2.921875 | 3 |
mmcls/models/utils/se_layer.py | YuxinZou/mmclassification | 1,190 | 4867 | <gh_stars>1000+
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from .make_divisible import make_divisible
class SELayer(BaseModule):
"""Squeeze-and-Excitation Module.
Args:
channels (int): The input... | 2.96875 | 3 |
instagram/admin.py | James19stack/instagram-copy_cat | 0 | 4868 | <reponame>James19stack/instagram-copy_cat<filename>instagram/admin.py
from django.contrib import admin
from .models import Images,Comments,Profile
# Register your models here.
class CommentInline(admin.TabularInline):
model=Comments
extra=3
class ImageInline(admin.ModelAdmin):
fieldsets=[
(Non... | 1.773438 | 2 |
mandelbruh/util.py | pereradrian/mandelbruh | 0 | 4869 | import numpy as np
def normalize(x):
return x / np.linalg.norm(x)
def norm_sq(v):
return np.dot(v,v)
def norm(v):
return np.linalg.norm(v)
def get_sub_keys(v):
if type(v) is not tuple and type(v) is not list:
return []
return [k for k in v if type(k) is str]
def to_vec3(v):
if isinstance(v, (float, int)):
... | 2.84375 | 3 |
core/recognizer.py | awen1988/yry | 129 | 4870 | """
recognize face landmark
"""
import json
import os
import requests
import numpy as np
FACE_POINTS = list(range(0, 83))
JAW_POINTS = list(range(0, 19))
LEFT_EYE_POINTS = list(range(19, 29))
LEFT_BROW_POINTS = list(range(29, 37))
MOUTH_POINTS = list(range(37, 55))
NOSE_POINTS = list(range(55, 65))
RIGHT_EYE_POINTS =... | 3.125 | 3 |
magvar.py | rafidmorshedi/mag-dec-api | 0 | 4871 | import requests
import time
from bs4 import BeautifulSoup
import re
def decdeg2dms(dd):
negative = dd < 0
dd = abs(dd)
minutes,seconds = divmod(dd*3600,60)
degrees,minutes = divmod(minutes,60)
if negative:
if degrees > 0:
degrees = -degrees
elif minutes > 0:
... | 3.203125 | 3 |
google-cloud-sdk/lib/googlecloudsdk/third_party/apis/datacatalog/v1beta1/datacatalog_v1beta1_messages.py | bopopescu/Social-Lite | 0 | 4872 | <filename>google-cloud-sdk/lib/googlecloudsdk/third_party/apis/datacatalog/v1beta1/datacatalog_v1beta1_messages.py
"""Generated message classes for datacatalog version v1beta1.
A fully managed and highly scalable data discovery and metadata management
service.
"""
# NOTE: This file is autogenerated and should not be e... | 1.742188 | 2 |
materials/migrations/0072_auto_20190422_1708.py | mgovoni-devel/MatD3 | 7 | 4873 | <reponame>mgovoni-devel/MatD3
# Generated by Django 2.1.7 on 2019-04-22 21:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('materials', '0071_auto_20190416_1557'),
]
operations = [
migrations.RemoveField(
model_name='atomicpositio... | 1.554688 | 2 |
Deep-Learning/Crowd-Count/src/data_preprocess.py | sadbb/CVCode | 1 | 4874 | # -*- coding:utf-8 -*-
# ------------------------
# written by <NAME>
# 2018-10
# ------------------------
import os
import skimage.io
from skimage.color import rgb2gray
import skimage.transform
from scipy.io import loadmat
import numpy as np
import cv2
import math
import warnings
import random
import torch
import mat... | 2.390625 | 2 |
for1.py | satyamraj123/set-of-python-programs | 0 | 4875 | fruit='banana'
x=len(fruit)
print(x) | 2.734375 | 3 |
Django_Intershala/recruiter/migrations/0004_auto_20210305_1551.py | samir321-pixel/Django_Intershala | 7 | 4876 | <reponame>samir321-pixel/Django_Intershala
# Generated by Django 3.1.7 on 2021-03-05 10:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruiter', '0003_auto_20210304_2132'),
]
operations = [
migrations.RemoveField(
mode... | 1.601563 | 2 |
src/promnesia/sources/telegram.py | halhenke/promnesia | 1,327 | 4877 | <reponame>halhenke/promnesia<filename>src/promnesia/sources/telegram.py
'''
Uses [[https://github.com/fabianonline/telegram_backup#readme][telegram_backup]] database for messages data
'''
from pathlib import Path
from textwrap import dedent
from typing import Optional, Union, TypeVar
from urllib.parse import unquote #... | 2.171875 | 2 |
shellmacros/istr.py | duaneellissd/shellmacros | 0 | 4878 | '''
Created on Dec 27, 2019
@author: duane
'''
DOLLAR = ord('$')
LBRACE = ord('{')
RBRACE = ord('}')
LPAREN = ord('(')
RPAREN = ord(')')
class IStrFindResult(object):
OK = 0
NOTFOUND = 1
SYNTAX = 2
def __init__(self):
self.result = IStrFindResult.SYNTAX
self.lhs = 0
self.rh... | 2.84375 | 3 |
cli.py | checktheroads/deenis | 4 | 4879 | <filename>cli.py
#!/usr/bin/env python3
"""
CLI for Accessing Deenis
"""
# Standard Imports
import sys
from pathlib import Path
# Module Imports
import click
# Path Fixes
working_dir = Path(__file__).resolve().parent
sys.path.append(str(working_dir))
# Project Imports
from deenis import Deenis
@click.group(
hel... | 2.921875 | 3 |
main_cl.py | spiolynn/pybo | 0 | 4880 | # coding: utf-8
from bigone import BigOneDog
from common import gen_logger
import logging
import time
import json
def strategy_eth_big_bnc_eth(dog):
"""
正向:买BIG/ETH -> 卖BIG/BNC -> 买ETH/BNC
反向:卖ETH/BNC -> 买BIG/BNC -> 卖BIG/ETH
:param dog: implemention of BigOneDog
:return: 正向收益率,反向收益率
"""
... | 2.3125 | 2 |
run_experiments.py | gahaalt/cifar-vs-tensorflow2 | 6 | 4881 | import os
import yaml
import logging
import importlib
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
logging.getLogger('tensorflow').disabled = True
from cifar_training_tools import cifar_training, cifar_error_test
def print_dict(d, tabs=0):
tab = '\t'
for key in d:
if type(d[key]) == dict:
pri... | 2.359375 | 2 |
json2yaml.py | cristicalin/tools | 0 | 4882 | <filename>json2yaml.py<gh_stars>0
#!/usr/bin/python
import sys
import yaml
import json
if __name__ == '__main__':
content = json.load(sys.stdin)
print yaml.dump(content, indent=2, default_flow_style=False)
| 2.078125 | 2 |
histdata/mt5db/script_DownloadAndStoreToMongodb.py | UpSea/midProjects | 1 | 4883 | # -*- coding: utf-8 -*-
import os,sys
from PyQt4 import QtGui,QtCore
dataRoot = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir,os.pardir,'histdata'))
sys.path.append(dataRoot)
import dataCenter as dataCenter
from data.mongodb.DataSourceMongodb import Mongodb
import datetime as dt
... | 2.109375 | 2 |
daproli/transformer.py | ermshaua/daproli | 0 | 4884 | <filename>daproli/transformer.py
from joblib import Parallel, delayed
from tqdm import tqdm
from .processing import map, filter, split, expand, combine, join
from .manipulation import windowed, flatten
class BaseTransformer:
'''
The BaseTransformer defines a generic data transformation pattern that
can b... | 2.59375 | 3 |
Ad-Hoc/2454.py | LorranSutter/URI-Online-Judge | 0 | 4885 | <gh_stars>0
P, R = input().split()
if P == '0': print('C')
elif R == '0': print('B')
else: print('A') | 3.46875 | 3 |
main.py | brunotoshio/castella | 2 | 4886 | <filename>main.py
import pymongo
import yaml
import sched
import time
import json
from castella import TweetCrawler
class Castella(object):
def __init__(self):
# Get connection parameters
with open("settings.yml", "r") as stream:
try:
settings = yaml.safe_load(stream)["... | 2.5 | 2 |
ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_slice.py | monroid/openvino | 2,406 | 4887 | <reponame>monroid/openvino
#
# slice paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle as pdpd
import sys
data_type = 'float32'
def slice(name : str, x, axes : list, start : list, end : list):
pdpd.enable_static()
with pdpd.static.program_guard(pdpd.static.Program(), ... | 2.46875 | 2 |
tacker/sol_refactored/common/vnf_instance_utils.py | h1r0mu/tacker | 116 | 4888 | # Copyright (C) 2021 Nippon Telegraph and Telephone Corporation
# 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/LICE... | 1.835938 | 2 |
testfixtures/compat.py | cjw296/testfixtures | 0 | 4889 | # compatibility module for different python versions
import sys
if sys.version_info[:2] > (3, 0):
PY2 = False
PY3 = True
Bytes = bytes
Unicode = str
basestring = str
class_type_name = 'class'
ClassType = type
exception_module = 'builtins'
new_class = type
self_name = '__self_... | 2.390625 | 2 |
old_py2/tests/models_tests/notifications/test_match_score.py | ofekashery/the-blue-alliance | 266 | 4890 | <reponame>ofekashery/the-blue-alliance<filename>old_py2/tests/models_tests/notifications/test_match_score.py<gh_stars>100-1000
import re
import unittest2
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from consts.notification_type import NotificationType
from helpers.event.event_test_cr... | 2.296875 | 2 |
util/submission/templates.py | jeanlucf22/mgmol | 25 | 4891 | md_template_d144 = """verbosity=0
xcFunctional=PBE
FDtype=4th
[Mesh]
nx=160
ny=80
nz=80
[Domain]
ox=0.
oy=0.
oz=0.
lx=42.4813
ly=21.2406
lz=21.2406
[Potentials]
pseudopotential=pseudo.D_tm_pbe
[Poisson]
solver=@
max_steps_initial=@50
max_steps=@50
reset=@
bcx=periodic
bcy=periodic
bcz=periodic
[Run]
type=MD
[MD]
type=@... | 1.078125 | 1 |
Compliant_control/Force Tracking/archive/VIC_Huang1992_(main 09.03).py | martihmy/Compliant_control | 0 | 4892 | #! /usr/bin/env python
import copy
from copy import deepcopy
import rospy
import threading
import quaternion
import numpy as np
from geometry_msgs.msg import Point
from visualization_msgs.msg import *
from franka_interface import ArmInterface
from panda_robot import PandaArm
import matplotlib.pyplot as plt
from scipy.s... | 2.625 | 3 |
tests/migrations/0010_modeltest_datetime_field1.py | intellineers/django-bridger | 2 | 4893 | # Generated by Django 2.2.9 on 2020-01-28 14:50
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("tests", "0009_auto_20200113_1239"),
]
operations = [
migrations.AddField(
model_name="modeltest",
... | 1.75 | 2 |
pycmap/common.py | mdashkezari/pycmap | 4 | 4894 | <reponame>mdashkezari/pycmap
"""
Author: <NAME> <<EMAIL>>
Date: 2019-06-28
Function: Host a collection of shared multi-purpose helper functions.
"""
import os
import sys
from tqdm import tqdm
from colorama import Fore, Back, Style, init
import numpy as np
import pandas as pd
import webbrowser
import I... | 2.4375 | 2 |
tests/test_device.py | michaelwoods/home-assistant-cli | 0 | 4895 | """Testing Device operations."""
import json
import unittest.mock as mock
from click.testing import CliRunner
import homeassistant_cli.cli as cli
def test_device_list(default_devices) -> None:
"""Test Device List."""
with mock.patch(
'homeassistant_cli.remote.get_devices', return_value=default_devic... | 2.796875 | 3 |
widgets/tree_item.py | tarsa129/j3d-animation-editor | 6 | 4896 | <filename>widgets/tree_item.py<gh_stars>1-10
from PyQt5.QtWidgets import QAction, QTreeWidget, QTreeWidgetItem, QFileDialog
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt
import animations.general_animation as j3d
from widgets.yaz0 import compress, compress_slow, compress_fast
from io import BytesIO
class ... | 2.515625 | 3 |
Wheels.py | edhosken/WheelsSong | 0 | 4897 | <gh_stars>0
#Create the pre-defined song values and empty variables...Correct names not used so each starting letter would be unique
numbers = (1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 )
letters = ['a ','b ','c ','d ','e ','f ','g ','h ','i ','j ','k ','l ','m ','n ','o ','p ','q ','r ']
roman =... | 2.640625 | 3 |
tests/test_config.py | dfroger/conda | 0 | 4898 | # (c) 2012-2014 Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
from os.path import dirname, join, exists
import unittest
import pytest
import con... | 1.882813 | 2 |
malaya/transformers/babble.py | ahmed3991/malaya | 1 | 4899 | <filename>malaya/transformers/babble.py
# Bert has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model,
# by <NAME>, <NAME>, NeuralGen 2019
# https://colab.research.google.com/drive/1MxKZGtQ9SSBjTK5ArsZ5LKhkztzg52RV
# https://arxiv.org/abs/1902.04094
import tensorflow as tf
import tensorflow_proba... | 2.46875 | 2 |