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 |
|---|---|---|---|---|---|---|
analysis/networks/autoencoder/train_eval.py | nriesterer/iccm-neural-bound | 0 | 3300 | <filename>analysis/networks/autoencoder/train_eval.py
""" Evaluates the training performance of the autoencoder.
"""
import time
import pandas as pd
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
import ccobra
import onehot
import autoencoder
# General settings
training_datafil... | 2.59375 | 3 |
Tools/GAutomator/wpyscripts/uiautomator/uiautomator_manager.py | Aver58/ColaFrameWork | 1 | 3301 | #-*- coding: UTF-8 -*-
"""
Tencent is pleased to support the open source community by making GAutomator available.
Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a... | 2.078125 | 2 |
IMU/VTK-6.2.0/Filters/Core/Testing/Python/TestSynchronizedTemplates3D.py | timkrentz/SunTracker | 0 | 3302 | <gh_stars>0
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
class TestSynchronizedTemplates3D(Testing.vtkTest):
def testAll(self):
reader = vtk.vtkImageReader()
reader.SetDataByteOrderToLittleEndian()
reader... | 1.921875 | 2 |
deserialize/__init__.py | iAndriy/deserialize | 0 | 3303 | """A module for deserializing data to Python objects."""
# pylint: disable=unidiomatic-typecheck
# pylint: disable=protected-access
# pylint: disable=too-many-branches
# pylint: disable=wildcard-import
import enum
import functools
import typing
from typing import Any, Callable, Dict, List, Optional, Union
from deser... | 2.421875 | 2 |
tests/test_get_set.py | snoopyjc/ssf | 3 | 3304 | from ssf import SSF
ssf = SSF(errors='raise')
def test_get_set_days():
dn = ssf.get_day_names()
assert isinstance(dn, tuple)
assert dn == (('Mon', 'Monday'),
('Tue', 'Tuesday'),
('Wed', 'Wednesday'),
('Thu', 'Thursday'),
('Fri', 'Friday'),
('Sat',... | 2.625 | 3 |
script.py | devppratik/Youtube-Downloader | 0 | 3305 | <filename>script.py<gh_stars>0
import os
import pyfiglet
from pytube import YouTube, Playlist
file_size = 0
folder_name = ""
# Progress Bar
def print_progress_bar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='#', print_end="\r"):
percent = ("{0:." + str(decimals) + "f}").format(100 *
... | 2.921875 | 3 |
test/python/test.py | alex952/cdr | 0 | 3306 | #
# Copyright 2014-2018 Neueda Ltd.
#
from cdr import Cdr
import unittest
field1 = 1
field2 = 2
field3 = 55
class TestCdr(unittest.TestCase):
def get_a_cdr(self):
d = Cdr()
d.setInteger(field1, 123)
d.setString(field2, "Hello")
d.setString(field3, "World")
return d
... | 3.359375 | 3 |
vendor/mo_times/vendor/dateutil/tz.py | klahnakoski/auth0-api | 0 | 3307 | <gh_stars>0
"""
Copyright (c) 2003-2007 <NAME> <<EMAIL>>
This module offers extensions to the standard Python
datetime module.
"""
import datetime
import os
import struct
import sys
import time
from mo_future import PY3, string_types
__license__ = "Simplified BSD"
__all__ = ["tzutc", "tzoffset", "tzlocal", "tzfile... | 2.828125 | 3 |
example/first_example/window/inputWindow/view.py | suuperhu/Pyside2MVCFramework | 1 | 3308 | # -*- coding: utf-8 -*-
"""
# @SoftwareIDE : PyCharm2020Pro
# @ProjectName : PySide2MVCFramework
# @FileName : view.py
# @Author : 胡守杰
# @Email : <EMAIL>
# @ZhFileDescription :
# @EnFileDescription :
"""
import os
from pyside2mvcframework.core.view import... | 2.078125 | 2 |
src/finn/custom_op/fpgadataflow/streamingfifo.py | AlexMontgomerie/finn | 283 | 3309 | # Copyright (c) 2020, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the follow... | 1.351563 | 1 |
android_fonts.py | chrissimpkins/android_fonts | 1 | 3310 | import ast
import emoji
import os
import pandas as pd
_SUPPORT_CACHE_CSV = emoji.datafile('emoji_support.csv')
_API_LEVELS = {
1: ("(no codename)", "1.0"),
2: ("(no codename)", "1.1"),
3: ("Cupcake", "1.5 "),
4: ("Donut", "1.6 "),
5: ("Eclair", "2.0"),
6: ("Eclair", "2.0.1"),
7: ("Eclair", "2.1 "),
8:... | 2.484375 | 2 |
tests/test_list.py | amikrop/django-paste | 3 | 3311 | import json
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from paste import constants
from tests.mixins import SnippetListTestCaseMixin
from tests.utils import constant, create_snippet, create_user
class SnippetListTestCase(SnippetListTestCaseMixin, ... | 2.5 | 2 |
Algorithmic Toolbox/Greedy Algorithms/Maximum Advertisement Revenue/maximum_ad_revenue.py | ganeshbhandarkar/Python-Projects | 9 | 3312 | <gh_stars>1-10
# python3
from itertools import permutations
def max_dot_product_naive(first_sequence, second_sequence):
assert len(first_sequence) == len(second_sequence)
assert len(first_sequence) <= 10 ** 3
assert all(0 <= f <= 10 ** 5 for f in first_sequence)
assert all(0 <= s <= 10 ** 5 for s in ... | 3.15625 | 3 |
HelloWorldPython/IfStatements.py | SamIge7/Tutorials | 0 | 3313 | <gh_stars>0
hasGoodCredit = True
price = 1000000
deposit = 0
if hasGoodCredit:
deposit = price/10
else:
deposit = price/5
print(f"Deposit needed: £{deposit}") | 2.703125 | 3 |
main.py | vsundesha/documentation-hub-dependencies | 0 | 3314 | <reponame>vsundesha/documentation-hub-dependencies<gh_stars>0
import config as props
import sys
import getopt
from GitHubDataFetcher import GitHubDataFetcher
from DependencyFile import DependencyFile
from ErrorFile import ErrorFile
# Github Token
TOKEN = props.token
OWNER = ""
REPOSITORY = ""
OUTPUTFILE =... | 2.578125 | 3 |
inference_realesrgan.py | blabra/Real-ESRGAN | 0 | 3315 | import argparse
import cv2
import glob
import os
from basicsr.archs.rrdbnet_arch import RRDBNet
import time
from realesrgan import RealESRGANer
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
def main():
"""Inference demo for Real-ESRGAN.
"""
parser = argparse.ArgumentParser()
parser.add_argu... | 2.25 | 2 |
examples/Fe__vasp/Fe_fcc_afm_D/Fe_fcc_afm_D_vac_A/clean_vasp.py | eragasa/pypospack | 4 | 3316 | <reponame>eragasa/pypospack
import os
filenames_delete = [
'CHG',
'CHGCAR',
'CONTCAR',
'DOSCAR',
'EIGENVAL',
'IBZKPT',
'job.err',
'job.out',
'OSZICAR',
'PCDAT',
'REPORT',
'vasp.log',
'vasprun.xml',
'WAVECAR',
'XDATCAR'
]
for filename in filen... | 2.71875 | 3 |
binary_trees/largest_values_in_tree_rows.py | ethyl2/code_challenges | 0 | 3317 | <gh_stars>0
'''
<NAME>'s solution.
See mine in largest_values_in_each_row.py
'''
from collection import deque
def largest_values_in_tree_rows(t):
rv = []
if t is None:
return rv
current_depth = 0
current_max = t.value
q = deque()
# add the root node to the queue at a depth of 0
... | 3.234375 | 3 |
src/infer/_ExtractSimpleDeformTTA.py | RamsteinWR/PneumoniaRSNA1 | 0 | 3318 | <reponame>RamsteinWR/PneumoniaRSNA1
import json
import os
import re
import numpy as np
import pandas as pd
from src.infer.ExtractDeformableTTA import MAPPINGS_PATH, test_image_set, METADATA_PATH, RCNN0_DETS_DIR
WDIR = os.path.dirname(os.path.abspath(__file__))
def get_results(det_folder, test_set, suffix):
fil... | 2.390625 | 2 |
pool4.py | yfii/yfiiapi | 4 | 3319 | from web3 import Web3, HTTPProvider
import json
w3url = "https://mainnet.infura.io/v3/998f64f3627548bbaf2630599c1eefca"
w3 = Web3(HTTPProvider(w3url))
WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
YFII = "0xa1d0E215a23d7030842FC67cE582a6aFa3CCaB83"
DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
iUSDT = "0x... | 2.203125 | 2 |
obswebsocket/requests.py | PanBartosz/obs-websocket-py | 123 | 3320 | <filename>obswebsocket/requests.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# THIS FILE WAS GENERATED BY generate_classes.py - DO NOT EDIT #
# (Generated on 2020-12-20 18:26:33.661372) #
from .base_classes import Baserequests
class GetVersion(Baserequests):
"""Returns the latest version o... | 2.0625 | 2 |
simple_history/tests/custom_user/admin.py | rdurica/django-simple-history | 911 | 3321 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import CustomUser
admin.site.register(CustomUser, UserAdmin)
| 1.335938 | 1 |
tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/mtcnn_evaluator_utils.py | Pandinosaurus/open_model_zoo | 1 | 3322 | """
Copyright (c) 2018-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | 1.796875 | 2 |
pytests/Atomicity/basic_ops.py | ashwin2002/TAF | 0 | 3323 | <gh_stars>0
from Cb_constants import DocLoading
from basetestcase import ClusterSetup
from couchbase_helper.documentgenerator import DocumentGenerator, doc_generator
from couchbase_helper.tuq_generators import JsonGenerator
from remote.remote_util import RemoteMachineShellConnection
from sdk_client3 import SDKClient
f... | 1.84375 | 2 |
reverseWord.py | lovefov/Python | 0 | 3324 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
#Author:贾江超
def spin_words(sentence):
list1=sentence.split()
l=len(list1)
for i in range(l):
relen = len(sentence.split()[i:][0])
if relen > 5:
list1[i]=list1[i][::-1]
return ' '.join(list1)
'''
注意 在2.x版本可以用len()得到list的长度 3.x版本就不行... | 3.6875 | 4 |
src/scs_host/comms/network_socket.py | south-coast-science/scs_host_cpc | 0 | 3325 | <reponame>south-coast-science/scs_host_cpc<gh_stars>0
"""
Created on 30 May 2017
@author: <NAME> (<EMAIL>)
A network socket abstraction, implementing ProcessComms
"""
import socket
import time
from scs_core.sys.process_comms import ProcessComms
# -------------------------------------------------------------------... | 2.671875 | 3 |
dateparser/date.py | JKhakpour/dateparser | 2 | 3326 | <reponame>JKhakpour/dateparser
# -*- coding: utf-8 -*-
import calendar
import collections
from datetime import datetime, timedelta
from warnings import warn
import six
import regex as re
from dateutil.relativedelta import relativedelta
from dateparser.date_parser import date_parser
from dateparser.freshness_date_pars... | 2.03125 | 2 |
src/models/functions/connection/mixture_density_network.py | kristofbc/handwriting-synthesis | 0 | 3327 | import chainer
import chainer.functions
from chainer.utils import type_check
from chainer import cuda
from chainer import function
import numpy as np
#from chainer import function_node
from utils import clip_grad
#class MixtureDensityNetworkFunction(function_node.FunctionNode):
class MixtureDensityNetworkFunction(fu... | 2.1875 | 2 |
flask__webservers/bootstrap_4__toggle_switch__examples/main.py | DazEB2/SimplePyScripts | 0 | 3328 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/twbs/bootstrap
# SOURCE: https://github.com/gitbrent/bootstrap4-toggle
# SOURCE: https://gitbrent.github.io/bootstrap4-toggle/
from flask import Flask, render_template
app = Flask(__... | 2.40625 | 2 |
dev/phonts/visualization/phonts.py | eragasa/pypospack | 4 | 3329 | <gh_stars>1-10
import pypospack.io.phonts as phonts
# <---- additional classes and functions in which to add top
# <---- pypospack.io.phonts
if __name__ == "__main__":
| 1.296875 | 1 |
omegaconf/_utils.py | sugatoray/omegaconf | 1,091 | 3330 | <reponame>sugatoray/omegaconf<gh_stars>1000+
import copy
import os
import re
import string
import sys
import warnings
from contextlib import contextmanager
from enum import Enum
from textwrap import dedent
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Tuple,
Type,
Union,
... | 2.328125 | 2 |
darc/amber_clustering.py | loostrum/darc | 0 | 3331 | <gh_stars>0
#!/usr/bin/env python3
#
# AMBER Clustering
import os
from time import sleep
import yaml
import ast
import threading
import multiprocessing as mp
import numpy as np
from astropy.time import Time, TimeDelta
import astropy.units as u
from astropy.coordinates import SkyCoord
from darc import DARCBase, VOEve... | 2.140625 | 2 |
tools/load_demo_data.py | glenn2763/skyportal | 0 | 3332 | import datetime
import os
import subprocess
import base64
from pathlib import Path
import shutil
import pandas as pd
import signal
import requests
from baselayer.app.env import load_env
from baselayer.app.model_util import status, create_tables, drop_tables
from social_tornado.models import TornadoStorage
from skyport... | 1.875 | 2 |
framework/Exploits/CUTEFLOW_0024.py | UncleWillis/BugBox | 1 | 3333 |
# Copyright 2013 University of Maryland. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE.TXT file.
import sys
import os
import time
from selenium.common.exceptions import NoAlertPresentException
import framework
class Exploit (framework.Exploit... | 2.40625 | 2 |
telethon/tl/custom/button.py | HosseyNJF/Telethon | 4 | 3334 | <reponame>HosseyNJF/Telethon
from .. import types
from ... import utils
class Button:
"""
.. note::
This class is used to **define** reply markups, e.g. when
sending a message or replying to events. When you access
`Message.buttons <telethon.tl.custom.message.Message.buttons>`
... | 3.328125 | 3 |
src/main/resources/pys/join.py | addUsername/javaBoring | 0 | 3335 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 7 20:14:22 2020
Simple script to join json files
@author: SERGI
"""
import json
import sys
import os
def readJson(path):
with open(path, "r") as file:
return json.load(file)
def writeJson(path, dicc):
with open(path, "w") as file... | 3.203125 | 3 |
app/grandchallenge/challenges/migrations/0023_auto_20200123_1102.py | njmhendrix/grand-challenge.org | 1 | 3336 | # Generated by Django 3.0.2 on 2020-01-23 11:02
import re
import django.contrib.postgres.fields.citext
import django.core.validators
from django.db import migrations
import grandchallenge.challenges.models
class Migration(migrations.Migration):
dependencies = [
("challenges", "0022_auto_20200121_1639"... | 2 | 2 |
autosk_dev_test/component/LinReg.py | hmendozap/master-arbeit-files | 2 | 3337 | <reponame>hmendozap/master-arbeit-files
import numpy as np
import scipy.sparse as sp
from HPOlibConfigSpace.configuration_space import ConfigurationSpace
from HPOlibConfigSpace.conditions import EqualsCondition, InCondition
from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerH... | 1.757813 | 2 |
python_work/Chapter5/exe3_alien_color.py | Elektra-2/python_crash_course_2nd | 1 | 3338 | <filename>python_work/Chapter5/exe3_alien_color.py
# Creating a elif chain
alien_color = 'red'
if alien_color == 'green':
print('Congratulations! You won 5 points!')
elif alien_color == 'yellow':
print('Congratulations! You won 10 points!')
elif alien_color == 'red':
print('Congratulations! You won 15 p... | 3.984375 | 4 |
DigiPsych_API/Data_Science_API/evaluate_model.py | larryzhang95/Voice-Analysis-Pipeline | 7 | 3339 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import learning_curve
# Plot learning curve
def plot_learning_curve(estimator, title, X, y, ylim=None, cv=None,
n_jobs=1, train_sizes=np.linspace(.1, 1.0, 5)):
plt.figu... | 3.5 | 4 |
oomi/__init__.py | sremes/oomi | 0 | 3340 | """Utilities for downloading comsumption data from Oomi."""
from oomi.oomi_downloader import OomiDownloader, OomiConfig
| 1.25 | 1 |
BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py | KaoTuz/edk2-stable202108 | 9 | 3341 | ## @file
# This file is used to define class objects of INF file miscellaneous.
# Include BootMode/HOB/Event and others. It will consumed by InfParser.
#
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
'''
InfMisc
'''
import Logger.Log as Logge... | 2.15625 | 2 |
21-08/Starters8/1.py | allenalvin333/Codechef_Competitions | 0 | 3342 | # https://www.codechef.com/START8C/problems/PENALTY
for T in range(int(input())):
n=list(map(int,input().split()))
a=b=0
for i in range(len(n)):
if(n[i]==1):
if(i%2==0): a+=1
else: b+=1
if(a>b): print(1)
elif(b>a): print(2)
else: print(0) | 2.75 | 3 |
util/eval.py | jhong93/vpd | 7 | 3343 | <filename>util/eval.py
import matplotlib.pyplot as plt
from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix
def save_confusion_matrix(truth, pred, out_file, norm=None):
label_names = list(set(truth) | set(pred))
label_names.sort()
truth_compact = [label_names.index(x) for x in truth]
p... | 2.75 | 3 |
python/py3study/pytorch-lab/demo-cifar.py | sillyemperor/langstudy | 0 | 3344 | import torch
import torchvision
import torchvision.transforms as transforms
import os.path
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
root = os.path.join(BASE_DIR, '../data/')
trainset ... | 2.875 | 3 |
astroquery/neodys/tests/test_neodys_remote.py | B612-Asteroid-Institute/astroquery | 0 | 3345 |
from ... import neodys
def test_neodys_query():
test_object = "2018VP1"
res_kep_0 = neodys.core.NEODyS.query_object(
test_object, orbital_element_type="ke", epoch_near_present=0)
res_kep_1 = neodys.core.NEODyS.query_object(
test_object, orbital_element_type="ke", epoch_near_present=1)
... | 2.203125 | 2 |
corehq/apps/accounting/migrations/0026_auto_20180508_1956.py | kkrampa/commcare-hq | 1 | 3346 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-08 19:56
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations
def noop(*args, **kwargs):
pass
def _convert_emailed_to_array_field(apps, schema_editor):
BillingRecord =... | 1.851563 | 2 |
tensor2tensor/rl/evaluator.py | SouBanerjee/tensor2tensor | 1 | 3347 | # coding=utf-8
# Copyright 2018 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... | 1.65625 | 2 |
src/part_2_automation/test_test1.py | AndreiHustiuc/IT_Factory_Course | 0 | 3348 | <reponame>AndreiHustiuc/IT_Factory_Course
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium... | 2.640625 | 3 |
app/grandchallenge/components/admin.py | njmhendrix/grand-challenge.org | 1 | 3349 | from django.contrib import admin
from grandchallenge.components.models import (
ComponentInterface,
ComponentInterfaceValue,
)
class ComponentInterfaceAdmin(admin.ModelAdmin):
list_display = (
"pk",
"title",
"slug",
"kind",
"default_value",
"relative_path",... | 1.820313 | 2 |
publishtimer/__init__.py | paragguruji/publishtimer | 0 | 3350 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 28 15:28:24 2016
@author: <NAME>, <EMAIL>
"""
from .helpers import setup_env
done = setup_env() | 1.015625 | 1 |
netdisco/discoverables/nanoleaf_aurora.py | jjlawren/netdisco | 1 | 3351 | <reponame>jjlawren/netdisco<filename>netdisco/discoverables/nanoleaf_aurora.py
"""Discover Nanoleaf Aurora devices."""
from . import MDNSDiscoverable
class Discoverable(MDNSDiscoverable):
"""Add support for discovering Nanoleaf Aurora devices."""
def __init__(self, nd):
super(Discoverable, self).__in... | 1.679688 | 2 |
debug/compute_score_common_ts_RETREAT.py | DavidSabbagh/meeg_power_regression | 1 | 3352 | import os.path as op
import numpy as np
import pandas as pd
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import RidgeCV
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import KFold, cross_val_score
import mne
from pyriemann.tangentspace import TangentSpace
import ... | 1.851563 | 2 |
bter/publish.py | mengalong/bter | 1 | 3353 | <filename>bter/publish.py
# Copyright 2017~ mengalong <<EMAIL>>
#
# 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 appl... | 2.140625 | 2 |
web3/_utils/module_testing/math_contract.py | y19818/web3.py | 0 | 3354 |
MATH_BYTECODE = (
"606060405261022e806100126000396000f360606040523615610074576000357c01000000000000"
"000000000000000000000000000000000000000000009004806316216f391461007657806361bc22"
"1a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d5780"
"63dcf537b11461014057610074565b... | 1.203125 | 1 |
dnsdb/config.py | nuby/open_dnsdb | 1 | 3355 | <reponame>nuby/open_dnsdb
# -*- coding: utf-8 -*-
import os
import sys
from datetime import timedelta
from oslo.config import cfg
CONF = cfg.CONF
CONF.register_opts([
cfg.StrOpt('log-dir'),
cfg.StrOpt('log-file'),
cfg.StrOpt('debug'),
cfg.StrOpt('verbose'),
], 'log')
CONF.register_opts([
cfg.St... | 1.945313 | 2 |
rover/rover.py | cloudy/osr-rover-code | 0 | 3356 | from __future__ import print_function
import time
from rover import Robot
from connections import Connections
class Rover(Robot, Connections):
def __init__( self,
config,
bt_flag = 0,
xbox_flag = 0,
unix_flag = 0
):
self.bt_flag = bt_flag
self.xbox_flag = xbox_flag
self.unix_flag =... | 2.671875 | 3 |
aswiki/parser.py | scanner/django-aswiki | 0 | 3357 | <filename>aswiki/parser.py
#
# File: $Id: parser.py 1865 2008-10-28 00:47:27Z scanner $
#
"""
This is where the logic and definition of our wiki markup parser lives.
We use the Python Creoleparser (which requires Genshi)
We make a custom dialect so that the parser can know the URL base for
all of the topics (pages) i... | 2.703125 | 3 |
oauth_api/validators.py | anobi/django-oauth-api | 0 | 3358 | <reponame>anobi/django-oauth-api
import base64
import binascii
from datetime import timedelta
from django.contrib.auth import authenticate
from django.utils import timezone
from oauthlib.oauth2 import RequestValidator
from oauth_api.models import get_application_model, AccessToken, AuthorizationCode, RefreshToken, A... | 2.40625 | 2 |
objects/fun_return.py | padmacho/pythontutorial | 0 | 3359 | def modify(y):
return y # returns same reference. No new object is created
x = [1, 2, 3]
y = modify(x)
print("x == y", x == y)
print("x == y", x is y) | 3.984375 | 4 |
edx_gen/_write_comps.py | hberndl70/mooc-generator | 0 | 3360 | import sys, os
import tarfile
import shutil
from edx_gen import _edx_consts
from edx_gen import _read_metadata
from edx_gen import _write_structure
from edx_gen import _write_comps
from edx_gen import _write_comp_html
from edx_gen import _write_comp_checkboxes
from edx_gen import _write_comp_video
from edx_gen i... | 2.125 | 2 |
grading_program.py | ByeonghoonJeon/Student-Grading | 0 | 3361 | # 1. Create students score dictionary.
students_score = {}
# 2. Input student's name and check if input is correct. (Alphabet, period, and blank only.)
# 2.1 Creat a function that evaluate the validity of name.
def check_name(name):
# 2.1.1 Remove period and blank and check it if the name is comprised with on... | 4.3125 | 4 |
test/test_utils.py | by46/recipe | 0 | 3362 | import unittest
from recipe import utils
class UtilTestCase(unittest.TestCase):
def test_valid_project_slug(self):
project_slug = "Recipe0123456789_mock"
self.assertTrue(utils.valid_project_slug(project_slug))
project_slug = 'Recipe00000000000000000000000000000000000000000000'
... | 3 | 3 |
extern/smplx_kinect/smplx_kinect/common/avakhitov_utils.py | wangxihao/rgbd-kinect-pose | 1 | 3363 | import numpy as np
import cv2
import os.path as osp
import json
from human_body_prior.tools.model_loader import load_vposer
import torch
vposer_ckpt = '/Vol1/dbstore/datasets/a.vakhitov/projects/pykinect_fresh/smplify-x/smplify-x-data/vposer_v1_0/'
def load_avakhitov_fits_vposer(vposer, part_path, dev_lbl):
po... | 2.171875 | 2 |
scripts/dev/dockerutil.py | axelbarjon/mongodb-kubernetes-operator | 1 | 3364 | import docker
from dockerfile_generator import render
import os
import json
from tqdm import tqdm
from typing import Union, Any, Optional
def build_image(repo_url: str, tag: str, path: str) -> None:
"""
build_image builds the image with the given tag
"""
client = docker.from_env()
print(f"Buildin... | 2.421875 | 2 |
scripts/VCF/UTILS/select_variants.py | elowy01/igsr_analysis | 3 | 3365 | <gh_stars>1-10
from VcfFilter import VcfFilter
import argparse
import os
#get command line arguments
parser = argparse.ArgumentParser(description='Script to select a certain variant type from a VCF file')
#parameters
parser.add_argument('--bcftools_folder', type=str, required=True, help='Folder containing the Bcfto... | 2.828125 | 3 |
site/tests/unittests/test/test_base64.py | martinphellwig/brython_wf | 652 | 3366 | <filename>site/tests/unittests/test/test_base64.py
import unittest
from test import support
import base64
import binascii
import os
import sys
import subprocess
class LegacyBase64TestCase(unittest.TestCase):
def test_encodebytes(self):
eq = self.assertEqual
eq(base64.encodebytes(b"www.python.org"... | 2.84375 | 3 |
appliance_catalog/migrations/0015_appliance_icon_py3.py | ChameleonCloud/portal | 3 | 3367 | <filename>appliance_catalog/migrations/0015_appliance_icon_py3.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-02-25 20:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
"""Updates ImageField syntax for later version.
"... | 1.210938 | 1 |
twitoff/twitter.py | ChristopherKchilton/twitoff-ChristopherKchilton | 1 | 3368 | <reponame>ChristopherKchilton/twitoff-ChristopherKchilton
"""Retrieve and request tweets from the DS API"""
import requests
import spacy
from .models import DB, Tweet, User
nlp = spacy.load("my_model")
def vectorize_tweet(tweet_text):
return nlp(tweet_text).vector
# Add and updates tweets
def add_or_update_use... | 3.25 | 3 |
day22.py | p88h/aoc2017 | 1 | 3369 | import io
grid = {}
y = 0
x = 0
for l in io.open("day22.in").read().splitlines():
for x in range(len(l)):
grid[(y,x)] = l[x]
y += 1
y = y // 2
x = x // 2
dx = 0
dy = -1
r = 0
for iter in range(10000000):
if (y,x) not in grid or grid[(y,x)] == '.':
(dy, dx) = (-dx, dy)
grid[(y,x)] = ... | 3.03125 | 3 |
ansys/dpf/core/errors.py | TheGoldfish01/pydpf-core | 11 | 3370 | from grpc._channel import _InactiveRpcError, _MultiThreadedRendezvous
from functools import wraps
_COMPLEX_PLOTTING_ERROR_MSG = """
Complex fields cannot be plotted. Use operators to get the amplitude
or the result at a defined sweeping phase before plotting.
"""
_FIELD_CONTAINER_PLOTTING_MSG = """"
This fields_conta... | 2.296875 | 2 |
deep_disfluency/feature_extraction/wer_calculation_from_final_asr_results.py | askender/deep_disfluency | 0 | 3371 | from mumodo.mumodoIO import open_intervalframe_from_textgrid
import numpy
from deep_disfluency.utils.accuracy import wer
final_file = open('wer_test.text', "w")
ranges1 = [line.strip() for line in open(
"/media/data/jh/simple_rnn_disf/rnn_disf_detection/data/disfluency_detection/swda_divisions_disfluency_detectio... | 2.40625 | 2 |
newsweec/utils/_dataclasses.py | Adwaith-Rajesh/newsweec | 13 | 3372 | from dataclasses import dataclass
from dataclasses import field
from time import time
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
@dataclass
class NewUser:
"""Deals with the commands the user is currently ... | 2.96875 | 3 |
vivo2notld/definitions/person_definition.py | gwu-libraries/vivo2notld | 5 | 3373 | <filename>vivo2notld/definitions/person_definition.py
from .document_summary import definition as document_summary_definition
from .organization_summary import definition as organization_summmary_definition
definition = {
"where": "?subj a foaf:Person .",
"fields": {
"name": {
"where": "?su... | 2.203125 | 2 |
apart/search.py | ruslan-ok/ServerApps | 1 | 3374 | <filename>apart/search.py
from django.db.models import Q
from hier.search import SearchResult
from .models import app_name, Apart, Meter, Bill, Service, Price
def search(user, query):
result = SearchResult(query)
lookups = Q(name__icontains=query) | Q(addr__icontains=query)
items = Apart.objects.filte... | 2.203125 | 2 |
pyrevolve/experiment_management.py | MRebolle/Battery-Robot | 0 | 3375 | <filename>pyrevolve/experiment_management.py<gh_stars>0
import os
import shutil
import numpy as np
from pyrevolve.custom_logging.logger import logger
import sys
class ExperimentManagement:
# ids of robots in the name of all types of files are always phenotype ids, and the standard for id is 'robot_ID'
def __... | 2.359375 | 2 |
books/model/Instrumentation.py | nudglabs/books-python-wrappers | 9 | 3376 | #$Id$
class Instrumentation:
"""This class is used tocreate object for instrumentation."""
def __init__(self):
"""Initialize parameters for Instrumentation object."""
self.query_execution_time = ''
self.request_handling_time = ''
self.response_write_time = ''
self.page_c... | 2.578125 | 3 |
DPR/setup.py | sophiaalthammer/parm | 18 | 3377 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from setuptools import setup
with open("README.md") as f:
readme = f.read()
setup(
name="dpr",
version="... | 1.132813 | 1 |
leetcode/hard/smallest_range/srcs/a_with_ordered_dict.py | BillionsRichard/pycharmWorkspace | 0 | 3378 | # encoding: utf-8
"""
@version: v1.0
@author: Richard
@license: Apache Licence
@contact: <EMAIL>
@site:
@software: PyCharm
@time: 2019/9/12 20:37
"""
from pprint import pprint as pp
from operator import itemgetter
import time
from collections import OrderedDict
from hard.smallest_range.srcs.big_2d_list impo... | 3.203125 | 3 |
pcf/particle/gcp/storage/storage.py | davidyum/Particle-Cloud-Framework | 0 | 3379 | <reponame>davidyum/Particle-Cloud-Framework<filename>pcf/particle/gcp/storage/storage.py
from pcf.core.gcp_resource import GCPResource
from pcf.core import State
import logging
from google.cloud import storage
from google.cloud import exceptions
logger = logging.getLogger(__name__)
class Storage(GCPResource):
"... | 2.578125 | 3 |
cimcb/utils/smooth.py | CIMCB/cimcb | 5 | 3380 | import numpy as np
def smooth(a, WSZ):
# a: NumPy 1-D array containing the data to be smoothed
# WSZ: smoothing window size needs, which must be odd number,
# as in the original MATLAB implementation
if WSZ % 2 == 0:
WSZ = WSZ - 1
out0 = np.convolve(a, np.ones(WSZ, dtype=int), 'valid') / W... | 2.984375 | 3 |
ezeeai/core/extensions/best_exporter.py | jmarine/ezeeai | 19 | 3381 | from __future__ import absolute_import
import abc
import os
import json
import glob
import shutil
from tensorflow.python.estimator import gc
from tensorflow.python.estimator import util
from tensorflow.python.estimator.canned import metric_keys
from tensorflow.python.framework import errors_impl
from tensorflow.pytho... | 2.0625 | 2 |
src/pkgcore/restrictions/restriction.py | mgorny/pkgcore | 0 | 3382 | <reponame>mgorny/pkgcore<filename>src/pkgcore/restrictions/restriction.py<gh_stars>0
# Copyright: 2005-2012 <NAME> <<EMAIL>
# Copyright: 2006 <NAME> <<EMAIL>>
# License: BSD/GPL2
"""
base restriction class
"""
from functools import partial
from snakeoil import caching, klass
from snakeoil.currying import pretty_docs... | 2.328125 | 2 |
keylime/migrations/versions/8da20383f6e1_extend_ip_field.py | kkaarreell/keylime | 18 | 3383 | """extend_ip_field
Revision ID: 8da20383f6e1
Revises: <KEY>
Create Date: 2021-01-14 10:50:56.275257
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "8da20383f6e1"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade(engine_name):
glob... | 1.445313 | 1 |
token_train/quickdemo(1)(1).py | Tatsuya26/processamento_de_linguagens | 0 | 3384 | <filename>token_train/quickdemo(1)(1).py
import ply.lex as lex
tokens =["NUM","OPERADORES"]
t_NUM = '\d+'
t_OPERADORES = '[+|*|-]'
t_ignore='\n\t '
def t_error(t):
print("Erro")
print(t)
lexer = lex.lex()
# 1+2 1-2 1*2
# ola mundo
import sys
for line in sys.stdin:
lexer.input(line)
for tok in lex... | 3.046875 | 3 |
ucsrb/migrations/0013_auto_20180710_2040.py | Ecotrust/ucsrb | 1 | 3385 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-07-10 20:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ucsrb', '0012_auto_20180710_1249'),
]
operations = [
migrations.AddField(
... | 1.632813 | 2 |
src/ctc/protocols/fei_utils/analytics/payload_crud.py | fei-protocol/checkthechain | 94 | 3386 | from __future__ import annotations
import typing
from ctc import spec
from . import timestamp_crud
from . import metric_crud
from . import analytics_spec
async def async_create_payload(
*,
blocks: typing.Sequence[spec.BlockNumberReference] | None = None,
timestamps: typing.Sequence[int] | None = None,
... | 2.234375 | 2 |
research/video_prediction/prediction_model.py | mbz/models | 1 | 3387 | # 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 applicab... | 2.078125 | 2 |
junit5/rules.bzl | prashantsharma04/bazel_java_rules | 1 | 3388 | <filename>junit5/rules.bzl
load("@rules_jvm_external//:defs.bzl", "artifact")
# For more information see
# - https://github.com/bmuschko/bazel-examples/blob/master/java/junit5-test/BUILD
# - https://github.com/salesforce/bazel-maven-proxy/tree/master/tools/junit5
# - https://github.com/junit-team/junit5-samples/tree/m... | 1.898438 | 2 |
tests/mocked_carla.py | fangedward/pylot | 0 | 3389 | # This module provides mocked versions of classes and functions provided
# by Carla in our runtime environment.
class Location(object):
""" A mock class for carla.Location. """
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
class Rotation(object):
""" A mock class... | 3.109375 | 3 |
rgb_to_cmyk.py | Zweizack/fuzzy-rainbow | 0 | 3390 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
ee = '\033[1m'
green = '\033[32m'
yellow = '\033[33m'
cyan = '\033[36m'
line = cyan+'-' * 0x2D
print(ee+line)
R,G,B = [float(X) / 0xFF for X in input(f'{yellow}RGB: {green}').split()]
K = 1-max(R,G,B)
C,M,Y = [round(float((1-X-K)/(1-K) * 0x64),1) for X in [R,G,B]]
K = r... | 2.9375 | 3 |
docs/updatedoc.py | JukeboxPipeline/jukedj | 2 | 3391 | <gh_stars>1-10
#!/usr/bin/env python
"""Builds the documentaion. First it runs gendoc to create rst files for the source code. Then it runs sphinx make.
.. Warning:: This will delete the content of the output directory first! So you might loose data.
You can use updatedoc.py -nod.
Usage, just call::
upd... | 2.3125 | 2 |
sort/selectionsort.py | vitormrts/sorting-algorithms | 0 | 3392 | def selection_sort(A): # O(n^2)
n = len(A)
for i in range(n-1): # percorre a lista
min = i
for j in range(i+1, n): # encontra o menor elemento da lista a partir de i + 1
if A[j] < A[min]:
min = j
A[i], A[min] = A[min], A[i] # insere o elemento na posicao corre... | 3.796875 | 4 |
BridgeOptimizer/scriptBuilder/ScriptBuilderBoundaryConditions.py | manuel1618/bridgeOptimizer | 1 | 3393 | import os
from typing import List, Tuple
from BridgeOptimizer.datastructure.hypermesh.LoadCollector import LoadCollector
from BridgeOptimizer.datastructure.hypermesh.LoadStep import LoadStep
from BridgeOptimizer.datastructure.hypermesh.Force import Force
from BridgeOptimizer.datastructure.hypermesh.SPC import SPC
cla... | 2.078125 | 2 |
Lekcija08/script01.py | islamspahic/python-uup | 0 | 3394 | tajniBroj = 51
broj = 2
while tajniBroj != broj:
broj = int(input("Pogodite tajni broj: "))
if tajniBroj == broj:
print("Pogodak!")
elif tajniBroj < broj:
print("Tajni broj je manji od tog broja.")
else:
print("Tajni broj je veci od tog broja.")
print("Kraj programa")
| 3.6875 | 4 |
tests/algorithms/memory/test_cmac.py | FrostByte266/neupy | 801 | 3395 | <gh_stars>100-1000
import numpy as np
from sklearn import metrics
from neupy import algorithms
from base import BaseTestCase
class CMACTestCase(BaseTestCase):
def test_cmac(self):
X_train = np.reshape(np.linspace(0, 2 * np.pi, 100), (100, 1))
X_train_before = X_train.copy()
X_test = np.r... | 2.171875 | 2 |
src/ggrc_workflows/models/task_group_object.py | Smotko/ggrc-core | 0 | 3396 | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: <EMAIL>
# Maintained By: <EMAIL>
from sqlalchemy.ext.associationproxy import association_proxy
from ggrc import db
from ggrc.models.mixins import ... | 1.898438 | 2 |
verification/tb_template.py | ahmednofal/DFFRAM | 0 | 3397 | # Copyright ©2020-2021 The American University in Cairo and the Cloud V Project.
#
# This file is part of the DFFRAM Memory Compiler.
# See https://github.com/Cloud-V/DFFRAM for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | 1.890625 | 2 |
services/stocks-api/app/api/clients/coinbase/CoinbaseResponse.py | krystianbajno/stocks | 3 | 3398 | <reponame>krystianbajno/stocks<filename>services/stocks-api/app/api/clients/coinbase/CoinbaseResponse.py<gh_stars>1-10
class CoinbaseResponse:
bid = 0
ask = 0
product_id = None
def set_bid(self, bid):
self.bid = float(bid)
def get_bid(self):
return self.bid
def set_ask(self, a... | 2.46875 | 2 |
xclim/indices/_anuclim.py | bzah/xclim | 1 | 3399 | # noqa: D100
from typing import Optional
import numpy as np
import xarray
from xclim.core.units import (
convert_units_to,
declare_units,
pint_multiply,
rate2amount,
units,
units2pint,
)
from xclim.core.utils import ensure_chunk_size
from ._multivariate import (
daily_temperature_range,
... | 2.4375 | 2 |