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 |
|---|---|---|---|---|---|---|
nweb_upload.py | pierce403/masspull | 13 | 51400 | #!/usr/bin/env python
import json
import time
import random
from sys import argv, exit
from elasticsearch import Elasticsearch, helpers
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
service_index = "masscan_services"
host_index = "nweb_hosts"
if len(argv)!=2:
exit("usage: nweb_upload.py <filename>")
fi... | 2.640625 | 3 |
collocation_node.py | UW-OCP/Collocation-Solver-CUDA | 0 | 51401 | <reponame>UW-OCP/Collocation-Solver-CUDA
import numpy as np
import scipy.linalg
class collocation_node:
"""
Node class for collocation solver, save the required DAE variables
at each time node
"""
'''
Input: size_y - size of the ODE variables
size_z - size of the DA... | 2.671875 | 3 |
pipeline/Main.py | JocCordova/XAIplayground | 0 | 51402 | import os
import numpy as np
from sys import platform, path
if platform == "linux" or platform == "linux2":
path.insert(1, os.path.dirname(os.getcwd()) + "/src")
FILE_NAME = os.path.dirname(os.getcwd()) + "/data" + "/xAPI-Edu-Data-Edited.csv"
elif platform == "win32":
path.insert(1, os.path.dirname(os.getc... | 2.71875 | 3 |
droidwiz/frontend/wx/device_frame.py | dumbledore/droidwiz | 0 | 51403 | import io
import time
import wx
from .screenshot_thread import ScreenshotThread, EVT_SCREENSHOT
class DeviceFrame(wx.Frame):
def __init__(self, device,
png=True,
resize_quality=wx.IMAGE_QUALITY_NORMAL,
size_divisor=640,
*args, **kwargs):
super().__init__(N... | 2.4375 | 2 |
apps/jetpack/templatetags/jetpack_extras.py | mozilla/FlightDeck | 6 | 51404 | from django.template import Library
from django.utils.safestring import mark_safe
register = Library()
@register.filter
def version_name(revision, autoescape=None):
name = "<strong>%s</strong> " % revision.version_name \
if revision.version_name else ""
return mark_safe("%srev. %d" % (name, revis... | 2.140625 | 2 |
test/test_test.py | otaithleigh/opswrapper | 3 | 51405 | <reponame>otaithleigh/opswrapper<filename>test/test_test.py<gh_stars>1-10
from pytest import raises
from opswrapper import test
def test_standard():
generated = test.NormUnbalance(1e-8, 50).tcl_code()
expected = 'test NormUnbalance 1e-08 50 0 2'
assert generated == expected
def test_with_flags():
g... | 2.359375 | 2 |
florodoro/widgets.py | xiaoxiae/Florodoro | 22 | 51406 | <reponame>xiaoxiae/Florodoro<filename>florodoro/widgets.py
import pickle
from typing import Optional
import qtawesome
from PyQt5.QtChart import QStackedBarSeries, QBarSet, QChart, QBarCategoryAxis, QChartView
from PyQt5.QtCore import QMargins, Qt
from PyQt5.QtGui import QPainter, QBrush
from PyQt5.QtWidgets import QWi... | 2.609375 | 3 |
src/pyft4222/wrapper/i2c/slave.py | lavovaLampa/pyft4222 | 0 | 51407 | <filename>src/pyft4222/wrapper/i2c/slave.py<gh_stars>0
from ctypes import POINTER, byref, c_char_p
from ctypes import c_void_p, c_uint8, c_uint16, c_bool
from typing import NewType
from ..dll_loader import ftlib
from .. import FtHandle, Result, Ok, Err, Ft4222Exception, Ft4222Status
I2cSlaveHandle = NewType("I2cSla... | 1.984375 | 2 |
applied_python/applied_python/lib/python2.7/site-packages/ansible/modules/core/files/file.py | mith1979/ansible_automation | 1 | 51408 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible 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 Software Foundation, either version 3 of the License, or
# (at yo... | 1.515625 | 2 |
src/main/python/gps/__init__.py | BikeAtor/WoMoAtor | 0 | 51409 | <reponame>BikeAtor/WoMoAtor
from .gps import GPS
from .gpsmap import GPSMap
| 1.085938 | 1 |
src/pipmate/parse/pipfile_decode.py | srujandeshpande/pipmate | 0 | 51410 | import toml
def pipfile_decode(data):
parsed_toml = toml.loads(data)
res = dict()
# print(parsed_toml)
res["dependencies"] = parsed_toml["packages"]
res["dev-dependencies"] = parsed_toml["dev-packages"]
return res
def pipfile_encode(data):
res = dict()
res["packages"] = dict()
f... | 2.765625 | 3 |
malib/algorithm/common/__init__.py | ReinholdM/play_football_with_human | 258 | 51411 | <filename>malib/algorithm/common/__init__.py
"""
__init__.py
@Organization:
@Author: <NAME>
@Time: 4/22/21 5:28 PM
@Function:
"""
| 0.96875 | 1 |
Projects/jobs/views.py | jjfleet/Capstone | 2 | 51412 | <reponame>jjfleet/Capstone
from django.shortcuts import render, reverse, get_object_or_404, redirect
from django.views.generic import TemplateView, ListView, DetailView, CreateView, UpdateView, DeleteView
from .models import JobListing
from django.contrib.auth.models import User
from django.contrib.auth.mixins import L... | 2.125 | 2 |
python/pyspark_hbase/sql/context.py | CrazyZero1/astro | 365 | 51413 | #
# 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 us... | 1.9375 | 2 |
art/estimators/poison_mitigation/strip/__init__.py | monshri/adversarial-robustness-toolbox | 1,350 | 51414 | """
STRIP estimators.
"""
from art.estimators.poison_mitigation.strip.strip import STRIPMixin
| 1.09375 | 1 |
openai/baselines/baselines/deepq/experiments/test_cloud.py | habichta/ETHZDeepReinforcementLearning | 7 | 51415 | import gym
from baselines import deepq
from baselines.common.atari_wrappers_deprecated import wrap_dqn, ScaledFloatFrame
from cloud_environment import CloudEnvironment
import numpy as np
import collections
import os
import csv
import pandas as pd
#Logging
def logger_callback(locals,globals):
done = locals[... | 2.296875 | 2 |
plotter.py | tylertjburns/ledgerkeeper | 0 | 51416 | <reponame>tylertjburns/ledgerkeeper<filename>plotter.py
from ledgerkeeper.mongoData.account import Account
import ledgerkeeper.mongoData.ledger_data_service as dsvcl
from ledgerkeeper.enums import SpendCategory
import ledgerkeeper.mongoData.account_data_service as dsvca
import balancesheet.mongoData.equities_data_servi... | 2.34375 | 2 |
leetcode/google/tagged/medium/missing_ranges_test.py | alvinctk/google-tech-dev-guide | 26 | 51417 | <filename>leetcode/google/tagged/medium/missing_ranges_test.py<gh_stars>10-100
import unittest
import missing_ranges as program
class TestCase(unittest.TestCase):
def setUp(self):
self.missing_range = program.Solution().findMissingRanges
self.t = self.assertMissingRange
def assertMissingRange(... | 3.1875 | 3 |
link/linktools/scripts/android/app.py | ice-black-tea/Zelda | 10 | 51418 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author : <NAME>
@file : at_app.py
@time : 2019/01/02
@site :
@software: PyCharm
,----------------, ,---------,
,-----------------------, ," ,"|
," ,"| ," ," |... | 1.875 | 2 |
2018/day05a.py | harendra263/AdventOfCode | 0 | 51419 | <filename>2018/day05a.py
def sametype(s1: str, s2: str) -> bool:
return s1.lower() == s2.lower()
def reduct(polymer: str)-> str:
did_reduce = True
while did_reduce :
did_reduce = False
for i in range(1, len(polymer)):
unit1 = polymer[i-1]
unit2 = polymer[... | 3.34375 | 3 |
pcWacomToMouseTouchpad.py | Amanita-muscaria/rmWacomToMouse | 50 | 51420 | <reponame>Amanita-muscaria/rmWacomToMouse
#!/usr/bin/env python3
'''
Meant to run on your PC.
Receives data generated by rmServerWacomInput.py,
moves the mouse and presses accordingly.
Acts like a touchpad.
'''
import socket
import struct
from pynput.mouse import Button, Controller
mouse = Controller()
# ---------... | 2.859375 | 3 |
tests/parsers/test_search_result.py | irico1997/linguee-api | 0 | 51421 | <gh_stars>0
from typing import Optional
import pytest
from linguee_api.const import LANGUAGE_CODE
from linguee_api.downloaders.file_cache import FileCache
from linguee_api.linguee_client import get_search_url
from linguee_api.parsers import XExtractParser
@pytest.mark.parametrize(
["query", "src", "dst", "is_no... | 2.28125 | 2 |
die_visual.py | 4bic-attic/data_viz | 0 | 51422 | <reponame>4bic-attic/data_viz<filename>die_visual.py
import pygal
from die import Die
#create a D6
die = Die()
#make some rolls and store the results in a list
results = []
for roll_num in range(1000):
result = die.roll()
results.append(result)
#Analyze the results
frequencies = []
for value in range(1, die... | 2.765625 | 3 |
Utils/QRCodeHelper.py | ADNRs/PyQR | 0 | 51423 | from itertools import product
from Tables import query
from .ImageHelper import *
get_width = lambda v: int(21 + 4*(v - 1))
def get_position_info(version:int) -> list:
width = get_width(version)
info = list()
color = [
[1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 1, 1, 0... | 2.515625 | 3 |
transition_srv/scripts/transition_model.py | tdonca/OpenBottle | 0 | 51424 | #!/usr/bin/env python
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import numpy as np
import scipy.io
import glob
import os
import csv
import random
import tensorflow as tf
import transition_model_common as tm
# import sys
# sys.path.append('./tensorflow_hmm')
# import tensorflow_hmm.hmm as hmm
... | 2.390625 | 2 |
utils/assets/__init__.py | Yzx835/AISafety | 0 | 51425 | # !/usr/bin/env python
# coding=UTF-8
"""
@Author: <NAME>
@LastEditors: <NAME>
@Description:
@Date: 2021-08-18
@LastEditTime: 2022-03-19
"""
import zipfile
import pickle
import gzip
import json
import re
from pathlib import Path
from typing import Union, Optional, Sequence
from ..strings import normalize_language, LA... | 2.765625 | 3 |
src/pymysql/connection.py | rrickgauer/pymysql | 0 | 51426 | <filename>src/pymysql/connection.py
import mysql.connector
from mysql.connector.cursor import MySQLCursor, MySQLCursorPrepared, MySQLCursorDict
from . import credentials as db_credentials
class ConnectionBase:
"""A MySQL database connection"""
#----------------------------------------------------------
#... | 3.359375 | 3 |
django_extras/templatetags/humanize_extras.py | gem/django-extras | 18 | 51427 | from django import template
from django_extras.utils import humanize
register = template.Library()
@register.filter(is_safe=True)
def describe_seconds(value):
"""
Convert a seconds value into a human readable (ie week, day, hour) value.
:param value: integer value of the number of seconds.
:return: ... | 2.609375 | 3 |
backend/db/friend.py | sleepingAnt/viewfinder | 645 | 51428 | # Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Friend relation.
Viewfinder friends define a relationship between two users predicated on confirmation of photo
sharing permission. Each friend has an associated 'status', which can be:
- 'friend': user has been marked as a friend; however, that user may no... | 2.09375 | 2 |
users/urls.py | shaxpakistan/e-stationery | 1 | 51429 | <filename>users/urls.py
from django.urls import path
from .views import *
urlpatterns = [
path('register/', RegisterView.as_view(), name = "register"),
path('<int:pk>/password/', PasswordsChangeView.as_view(), name = "password"),
path('profile/', ProfileView.as_view(), name = "profile"),
path('<i... | 1.992188 | 2 |
src/datasets/__init__.py | data-sachez-2511/pl_segmentation | 3 | 51430 | <reponame>data-sachez-2511/pl_segmentation
from datasets.coco_dataset import CocoDataset
| 0.953125 | 1 |
6_q-learning/Main.py | scottfabini/machine-learning-perceptron | 0 | 51431 | <reponame>scottfabini/machine-learning-perceptron
#!/usr/bin/env python3
"""
Homework 6 for CS545 Machine Learning at Portland State University
Perform experiments on Q-Learning
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sklearn.model_selection
import random
import math
import s... | 3.34375 | 3 |
bindings/python/pytests/pytests/utils/load_graphs.py | caufieldjh/ensmallen_graph | 0 | 51432 | from ensmallen_graph import EnsmallenGraph # pylint: disable=no-name-in-module
def load_hpo() -> EnsmallenGraph:
"""Test that HPO graph can be loaded."""
graph = EnsmallenGraph.from_unsorted_csv(
edge_path="./pytests/data/edges.tsv",
sources_column="subject",
destinations_column="obj... | 2.296875 | 2 |
scripts/rancher-cli.py | dustinvanbuskirk/docker-rancher-cd | 0 | 51433 | import sys
import getopt
import subprocess
def main(argv):
rancher_options = ''
rancher_command = ''
rancher_args = ''
try:
opts, args = getopt.getopt(argv, "o:c:a:", ["help", "rancher_options=", "rancher_command=", "rancher_args="])
except getopt.GetoptError:
print('Unrecognized A... | 2.90625 | 3 |
motoscrape/db.py | sairon/motoscrape | 2 | 51434 | <reponame>sairon/motoscrape<gh_stars>1-10
import glob
import json
ads_db = {}
def load_data():
try:
for file_ in glob.glob("scrapes/*.json"):
with open(file_, "r") as f:
data = json.load(f, "utf-8")
for item in data:
ads_db[item['permalink'... | 2.203125 | 2 |
tests/optional-neg/test.py | lean-delivery/tf-readme-validator | 0 | 51435 | <reponame>lean-delivery/tf-readme-validator<filename>tests/optional-neg/test.py
#!/usr/bin/env python
import unittest
import sys
sys.path.append('../../bin')
target = __import__('tf_readme_validator')
main = target.main
readme = target.cfg['readme']
class Test1(unittest.TestCase):
def test(self):
resul... | 2.375 | 2 |
src/docs.py | yaroslavNikolaev/A.R.M.O.R. | 1 | 51436 | <filename>src/docs.py
from utils.configuration import Configuration
from scanners import CollectorFactory
INTRO = '''
## A.R.M.O.R. - Altered-Reality Monitoring and Operational Response
### Mission
Detect difference between current version of installed software and the newest one.
ARMOR is designed to help d... | 2.4375 | 2 |
evaluation.py | zwChan/Word-embedding-and-semantics | 2 | 51437 | <reponame>zwChan/Word-embedding-and-semantics<gh_stars>1-10
from __future__ import division,print_function
__author__ = 'Jason'
import sys
import random
import csv
import logging
import gensim
from gensim import utils, matutils
# logger = logging.getLogger(__name__)
class EvaluateAnalogy:
def __init__(... | 2.96875 | 3 |
CS2420/Notes/Feb/2-12.py | Davidjbennett/DavidBennett.github.io | 3 | 51438 |
#! Unordered List Abstract Data type (UML Diagram)
# add(item) adds new item to list
# remove(item) removes item from the list
# search(item) searchs for item in the list. returns true of false
# isEmpty() test if list is empty or not
# length() returns number of items in the list
# append() adds item to end of list
#... | 3.421875 | 3 |
ecl/tests/unit/network/v2/test_quota.py | keiichi-hikita/eclsdk | 5 | 51439 | <filename>ecl/tests/unit/network/v2/test_quota.py
# 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 ag... | 2.234375 | 2 |
state_workflow_sdk/api/state_workflow/filterInstanceOfStateWorkflow_pb2.py | easyopsapis/easyops-api-python | 5 | 51440 | <filename>state_workflow_sdk/api/state_workflow/filterInstanceOfStateWorkflow_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: filterInstanceOfStateWorkflow.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobu... | 1.117188 | 1 |
test/TestApp.py | quadrupleflame/Untitled | 0 | 51441 | import unittest
import os, sys
from flask import Flask
from app import auth, api, db, home, create_app
import threading
import pytest
import requests
global flask
@pytest.fixture()
def server():
flask = create_app()
flask.run(host="localhost", port=5000)
class TestApp(unittest.TestCase):
def setUp(self... | 2.875 | 3 |
Anima.py | Daz-Riza-Seriog/Op_Heat_transfer | 0 | 51442 | import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
sns.set()
path = r'C:\Users\HP\PycharmProjects\Operaciones_Calor\Data.xlsx'
df = pd.read_excel("Data.xlsx")
df2 = pd.read_excel("time.xlsx")
df3 = np.transpose(df)
ax = sns.heatmap(data=df3)
plt.show() | 2.921875 | 3 |
fe_store/fake_db.py | PyExplorer/fe-store | 0 | 51443 | from fe_store.models import (
ProductType, Attribute, Measure, Product, Association, Value
)
products = [
{
"id": "1",
"name": "Ноутбук Xiaomi Mi Notebook Pro 15.6",
"type": "Ноутбук",
"price": "54 000",
"features": {
"Процессор": "Core i5",
"Част... | 1.640625 | 2 |
models/mlp.py | delldu/ImageZoomx | 1 | 51444 | <filename>models/mlp.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from models import register
import pdb
def make_coord(shape, flatten=True):
""" Make coordinates at grid centers.
"""
coord_seqs = []
for i, n in enumerate(shape):
v0, v1 = -1, 1
r =... | 2.9375 | 3 |
samples/vsphere/contentlibrary/vmtemplate/create_vm_template.py | restapicoding/VMware-SDK | 589 | 51445 | <reponame>restapicoding/VMware-SDK
#!/usr/bin/env python
"""
* *******************************************************
* Copyright VMware, Inc. 2017-2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS... | 1.875 | 2 |
grb/lat/query.py | Memcys/Fermi-GRB-Analysis | 2 | 51446 | """
This module deals with querying and downloading LAT FITS files.
"""
# Scientific Library
import numpy as np
import pandas as pd
# Requests Urls and Manupilate Files
from astropy.utils.data import download_files_in_parallel, download_file
from astroquery import fermi
from tqdm import tqdm
import requests
import ... | 2.65625 | 3 |
vuserver/parallel/serializers.py | vmware/test-automation-for-web-applications | 1 | 51447 | # Copyright 2022 VMware, Inc.
# SPDX-License-Identifier: Apache License 2.0
from .models import Client, Product, TestCase, UIEvent, Capture, Console
from rest_framework import serializers
class ClientSerializer(serializers.ModelSerializer):
class Meta:
model = Client
fields = ('id', 'uuid', 'role... | 1.835938 | 2 |
controllers/base_controller.py | allen-garvey/gae-library | 0 | 51448 | <reponame>allen-garvey/gae-library<filename>controllers/base_controller.py
import webapp2
import json
#base controller class
class BaseController(webapp2.RequestHandler):
#convenience method for writing json response
def write_json(self, json_string):
self.response.content_type = 'application/json'
... | 2.78125 | 3 |
Examples/BasicUsage/WorkingWithFolder/MoveFolder.py | groupdocs-annotation-cloud/groupdocs-annotation-cloud-python-samples | 0 | 51449 | # Import modules
import groupdocs_annotation_cloud
from Common import Common
class MoveFolder:
@classmethod
def Run(cls):
# Create instance of the API
api = groupdocs_annotation_cloud.FolderApi.from_config(Common.GetConfig())
try:
request = groupdocs_annotation... | 2.359375 | 2 |
ex098.py | paulo-caixeta/Exercicios_Curso_Python | 0 | 51450 | <filename>ex098.py
"""
Exercício Python 098: Faça um programa que tenha uma função chamada contador(), que receba três parâmetros: início, fim e passo.
Seu programa tem que realizar três contagens através da função criada:
a) de 1 até 10, de 1 em 1
b) de 10 até 0, de 2 em 2
c) uma contagem personalizada
"""
from time i... | 4.21875 | 4 |
srupy/models.py | alueschow/srupy | 1 | 51451 | <reponame>alueschow/srupy<gh_stars>1-10
# coding: utf-8
"""Collects classes for SRU-specific entities.
:copyright: Copyright 2020 <NAME>
"""
from lxml import etree
from .util import get_namespace, etree_to_dict, etree_to_dict_without_ns
class SRURecord(object):
"""A generic SRU record.
:param xml: XML repr... | 2.515625 | 3 |
direct/nn/varnet/config.py | cnmy-ro/direct-custom | 57 | 51452 | # coding=utf-8
# Copyright (c) DIRECT Contributors
from dataclasses import dataclass
from direct.config.defaults import ModelConfig
@dataclass
class EndToEndVarNetConfig(ModelConfig):
num_layers: int = 8
regularizer_num_filters: int = 18
regularizer_num_pull_layers: int = 4
regularizer_dropout: float... | 1.492188 | 1 |
src/pybeatsaver/beatsaver_provider.py | Kiyomi-Parents/PyBeatSaver | 0 | 51453 | <reponame>Kiyomi-Parents/PyBeatSaver
from typing import *
from faker.providers import BaseProvider
from .models import MapDetailMetadata, MapStats, UserDetail, AccountType, UserStats, UserDiffStats, MapVersion, MapState, \
MapDifficulty, Characteristic, Difficulty, MapParitySummary
from .models import MapDetail
... | 2.21875 | 2 |
py3status/modules/volume_status.py | ChoiZ/py3status | 0 | 51454 | <filename>py3status/modules/volume_status.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Display current sound volume using amixer.
Expands on the standard i3status volume module by adding color
and percentage threshold settings.
Volume up/down and Toggle mute via mouse clicks can be easily added see
example.
Configuratio... | 2.796875 | 3 |
watson-framework-archive/imcrypt/controllers/__init__.py | sigmundv/encrypt-image | 0 | 51455 | # -*- coding: utf-8 -*-
from imcrypt.controllers.index import Index
__all__ = ['Index']
| 1.023438 | 1 |
src/integrationtest/python/build_axle_tests.py | karellen/wheel-axle | 0 | 51456 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# (C) Copyright 2022 Karellen, Inc. (https://www.karellen.co/)
#
# 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/LIC... | 1.851563 | 2 |
Orest Lab 2/2d.py | PetroSidliar/Lab-2 | 0 | 51457 | grade = eval ( input ( ' Enter your credit: ' ))
if grade<=23:
print ( ' Freshman ' )
elif grade>=24 and grade<=53:
print ( ' Sophomore ' )
elif grade>=54 and grade<=83:
print ( ' Juniors ' )
elif grade>=84:
print ( ' Seniors ' )
| 4 | 4 |
aoc_wim/aoc2019/q15.py | wimglenn/advent-of-code-wim | 20 | 51458 | """
--- Day 15: Oxygen System ---
https://adventofcode.com/2019/day/15
"""
from collections import deque
from aocd import data
from aoc_wim.aoc2019 import IntComputer
from aoc_wim.search import AStar
from aoc_wim.zgrid import ZGrid
NACK = 0
ACK = 1
GOAL = 2
neighbours = {
-1j: 1, # NORTH
+1j: 2, # SOUTH
... | 3 | 3 |
Pyrado/pyrado/algorithms/meta/adr.py | swami1995/SimuRLacra | 52 | 51459 | # Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# 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 mus... | 1.148438 | 1 |
test/jpypetest/test_sql_generic.py | pitmanst/jpype | 531 | 51460 | # This file is Public Domain and may be used without restrictions.
import _jpype
import jpype
from jpype.types import *
from jpype import java
import jpype.dbapi2 as dbapi2
import common
import time
try:
import zlib
except ImportError:
zlib = None
class SQLModuleTestCase(common.JPypeTestCase):
def setUp(... | 2.296875 | 2 |
flask/Dashapps/math/Dash_App4.py | SchneiderDaniel/data | 0 | 51461 | <reponame>SchneiderDaniel/data
# -*- coding: utf-8 -*-
from dash import Dash
from dash.dependencies import Input, Output, ALL, State, MATCH, ALLSMALLER, ClientsideFunction
from ..Dash_fun import apply_layout_with_auth, load_object, save_object
import dash_core_components as dcc
import dash_html_components as html
impo... | 2.171875 | 2 |
src/lib/extra.py | bentherien/measevalcompetition | 0 | 51462 | <gh_stars>0
import src.exerptController
import networkx as nx
def getGraphPaths(sentences, sourceSpan, targetSpan, getSrc, getTrg, reverse=False, pos=False, docName = ""):
nonePassed = False
if(type(sentences) == type(None)):
print("sentences passed to getGraphPaths() as None")
nonePasse... | 2.515625 | 3 |
data_science_tools/stats.py | mellesies/data-science-tools | 0 | 51463 | """
Stats stuff!
"""
import textwrap
import numpy as np
import pandas as pd
from scipy import stats
from IPython.display import display
from .boxes import *
from .table_display import *
__DEBUG__ = False
def debug(*args, **kwargs):
if __DEBUG__:
print(*args, **kwargs)
class Chi2Result(object):
"... | 2.828125 | 3 |
tests/code/testjoy.py | pmp-p/python-wasm-plus | 3 | 51464 | <reponame>pmp-p/python-wasm-plus
#!/bin/env python3.11
import pygame as pg
try:
__EMSCRIPTEN__
except:
__EMSCRIPTEN__ = False
# Define some colors.
BLACK = pg.Color('black')
WHITE = pg.Color('white')
# This is a simple class that will help us print to the screen.
# It has nothing to do with the joysticks, ... | 3.4375 | 3 |
kshell_utilities/low_energy_enhancement.py | GaffaSnobb/kshell-utilities | 1 | 51465 | import os
import numpy as np
import matplotlib.pyplot as plt
from .kshell_utilities import atomic_numbers, loadtxt
from .general_utilities import create_spin_parity_list, gamma_strength_function_average
class LEE:
def __init__(self, directory):
self.bin_width = 0.2
self.E_max = 30
self.Ex_m... | 2.71875 | 3 |
utils/cascade_ml.py | cancertech/-cancer_diagnosis | 2 | 51466 | <gh_stars>1-10
def run_model(models, features):
# First decision
for experiment in ["Invasive v.s. Noninvasive",
"Atypia and DCIS v.s. Benign",
"DCIS v.s. Atypia"]:
pca = models[experiment + " PCA"]
if pca is not None:
features = pc... | 2.4375 | 2 |
(Ex4)_Neural_Network_model_implementation/initializeWeight.py | HarryPham0123/Coursera_Machine_learning_AndrewNg | 1 | 51467 | <gh_stars>1-10
import numpy as np
# TODO: Initialize weights with fixed (Can not change) dimension -> Useful for debugging (NOT DONE)
# "fan_in": # of nodes in layer "l"
# "fan_out": # of nodes in layer "l+1"
def debug_initialize_weight(fan_in, fan_out):
W = np.zeros((fan_out, fan_in+1))
W = np.reshap... | 2.625 | 3 |
unittests/test_models/test_model_helpers.py | imsb-uke/ecarenet | 1 | 51468 | <gh_stars>1-10
import tensorflow as tf
import unittest
from models.m_bin import m_bin
from models.m_isup import m_isup
from models.ecare_net import ecare_net
from models.model_helpers import compile_model
class TestModelCompileMBin(unittest.TestCase):
def test_mbin_compile(self):
model_config = {'base_mo... | 2.234375 | 2 |
gmso/tests/test_improper.py | shivrajkotkar/gmso | 0 | 51469 | <reponame>shivrajkotkar/gmso
import pytest
from gmso.core.improper import Improper
from gmso.core.improper_type import ImproperType
from gmso.core.atom_type import AtomType
from gmso.core.site import Site
from gmso.tests.base_test import BaseTest
from gmso.exceptions import GMSOError
class TestImproper(BaseTest):
... | 2.109375 | 2 |
node_modules/extsprintf/deps/javascriptlint/javascriptlint/util.py | tross78/placematch | 3 | 51470 | # vim: ts=4 sw=4 expandtab
import cgi
import os.path
import re
import unittest
_identifier = re.compile('^[A-Za-z_$][A-Za-z0-9_$]*$')
_contenttypes = (
'text/javascript',
'text/ecmascript',
'application/javascript',
'application/ecmascript',
'application/x-javascript',
)
class JSVersion:
def ... | 2.234375 | 2 |
stdlib2-src/dist-packages/quodlibet/util/songwrapper.py | ch1huizong/Scode | 0 | 51471 | # -*- coding: utf-8 -*-
# Copyright 2005 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation
from quodlibet import util
from quodlibet import qltk
from quodlibet.qltk.wlw import W... | 3.0625 | 3 |
wario/pipeline/Pipeline.py | McMasterRS/WARIO | 3 | 51472 | from .Node import Node
from blinker import signal
###################################################################################################
# Pipeline:
#
### The main process pipeline. Responsible for orchestrating a sequence of discrete tasks, as can
### be defined as an acyclic directed graph. Each node ru... | 2.765625 | 3 |
tests/unit/simulation/test_reset.py | AlexanderGrooff/discrete-event-simulation | 0 | 51473 | from simulation.framework import DiscreteSimulation
from tests.helpers import TestCase
class TestSimulationFramework(TestCase):
def setUp(self):
self.sim = DiscreteSimulation(max_duration=8, available_actions=[])
def test_reset_creates_new_timeline(self):
original_timeline = self.sim.timeline... | 2.875 | 3 |
example-bots/python/test3r.py | sandbergsimon42/diamonds2 | 0 | 51474 | import os
import time
while (True):
os.system("pipenv run start --token 1<PASSWORD> --board 1 --time-factor=1 --logic LowerRight")
time.sleep(1) | 2 | 2 |
niprov/repository.py | kambysese/niprov | 0 | 51475 |
class Repository(object):
def byLocation(self, locationString): # pragma: no cover
"""Get the provenance for a file at the given location.
In the case of a dicom series, this returns the provenance for the
series.
Args:
locationString (str): Loc... | 2.6875 | 3 |
2016/20_firewall_rules.py | pchudzik/adventofcode | 0 | 51476 | <gh_stars>0
"""
--- Day 20: Firewall Rules ---
You'd like to set up a small hidden computer here so you can use it to get back into the network later. However, the
corporate firewall only allows communication with certain external IP addresses.
You've retrieved the list of blocked IPs from the firewall, but the list ... | 3.984375 | 4 |
src/main.py | M3nin0/PyBot | 0 | 51477 | <gh_stars>0
from ChatBot import ChatBot
Bot = ChatBot("Felipe")
while True:
frase = Bot.escuta()
resp = Bot.pensa(frase)
Bot.fala(resp)
if resp == "tchau":
break
| 2.9375 | 3 |
tensorflow/compiler/plugin/poplar/tests/replicated_graph_test.py | DebeshJha/tensorflow-1 | 2 | 51478 | <reponame>DebeshJha/tensorflow-1
# Copyright 2020 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... | 1.976563 | 2 |
bazaar/decorators.py | Jonas-Quinn/deliverance | 1 | 51479 | from django.core.exceptions import PermissionDenied
from django.utils import timezone
from .models import Item
from datetime import datetime
def active_auction(function):
def wrap(request, *args, **kwargs):
item = Item.objects.get(slug=kwargs['slug'])
if item.end_of_auction > timezone.now():
... | 2.21875 | 2 |
exercise/2/2-5/test-all-code.py | toorevitimirp/SICP | 0 | 51480 | <reponame>toorevitimirp/SICP<gh_stars>0
import os
import subprocess
class Tester(object):
def __init__(self, dir='./'):
self.dir = dir
self.report_fn = "report.txt"
self.interpreter = "racket"
self.suffix = ".rkt"
def _program_files(self):
programs_list = []
al... | 2.4375 | 2 |
examples/storageDownloadFile.py | topcats/python-o365 | 0 | 51481 | #!/usr/bin/python3
# To generate an Office365 token:
# python3
# from O365 import Account
# account = Account(credentials=('yourregisteredappname', 'yoursecret'))
# account.authenticate(scopes=['files.read', 'user.read', 'offline_access'])
# It will return a URL, go to this in a browser, accept the permissions, the... | 2.96875 | 3 |
app/api_1_0/__init__.py | thinkingserious/apithyself | 0 | 51482 | from flask import Blueprint
from flask.ext.restful import Api
from .endpoints.goal import Goal
from .endpoints.weight import Weight
from .endpoints.calories import Calories
api_blueprint = Blueprint('api', __name__)
api = Api(prefix='/api/v1.0')
# Register the endpoints
api.add_resource(Goal, '/goal', '/goal')
api.ad... | 2.109375 | 2 |
cognigraph/tests/test_pipeline.py | ossadtchi/cognigraph | 0 | 51483 | """Tests for Pipeline class"""
import pytest
from cognigraph.nodes.pipeline import Pipeline
import numpy as np
from numpy.testing import assert_array_equal
from cognigraph.tests.prepare_pipeline_tests import (
create_dummy_info,
ConcreteSource,
ConcreteProcessor,
ConcreteOutput,
)
@pytest.fixture(scop... | 2.75 | 3 |
Python/6.5.7 fibonacci/program.py | jonasclaes/Provil_2018_2019 | 0 | 51484 | # Get the starting fibonacci numbers
start1 = int(input("First fibonacci number: "))
start2 = int(input("Second fibonacci number: "))
# New line
print("")
fibonacci = [start1, start2]
for i in range(2, 102):
current_fibonacci = fibonacci[i - 1] + fibonacci[i - 2]
fibonacci.append(current_fibonacci)
# Print a... | 4 | 4 |
src/scraper/scraper.py | jion/python-scraper | 0 | 51485 | from dombuilder import DomBuilder
from dom import SimpleDOM
from urllib2 import urlopen, URLError, HTTPError
# Scraper responsability:
# orquestate the steps of the scraping process:
# Construction phase:
# 1. create the proper reader (input)
# 2. construct the HTML parser
# 3. customize the HTML parser adding operat... | 3.671875 | 4 |
socket-service/codenames.py | TheSmartMonkey/codename | 1 | 51486 | import json
import sys
import os
import requests
class Codenames(object):
def __init__(self):
pass
| 1.703125 | 2 |
galaxy_dive/tests/test_read_data/test_rockstar.py | zhafen/galaxy-dive | 0 | 51487 | #!/usr/bin/env python
'''Testing for read_rockstar.py
@author: <NAME>
@contact: <EMAIL>
@status: Development
'''
import glob
from mock import call, patch
import numpy as np
import numpy.testing as npt
import os
import pdb
import pytest
import unittest
import galaxy_dive.read_data.rockstar as read_rockstar
import gal... | 2.078125 | 2 |
Week -2/Day-4 Maximum Product Subarray.py | Jeevan-kumar-Raj/September-LeetCoding-Challenge | 0 | 51488 | Day-4 Maximum Product Subarray.py
/*
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.
Example 1:
Input: [2,3,-2,4]
Output: 6
Explanation: [2,3] has the largest product 6.
Example 2:
Input: [-2,0,-1]
Output: 0
Ex... | 3.984375 | 4 |
recipes/forms.py | Bytlot/foodgram-project | 0 | 51489 | from django import forms
from .models import Recipe
class RecipeForm(forms.ModelForm):
class Meta:
model = Recipe
fields = (
'title',
'tags',
'cooking_time',
'text',
'image',
)
widgets = {
'tags': forms.Checkb... | 1.960938 | 2 |
info_theory.py | tyler-burkett/CS460-HW1 | 0 | 51490 | import math
from pandas_util import values_of, subset_by_value
def entropy(samples, bins=None):
"""
Compute entropy of given set of sample data points
Parameters:
samples - Pandas DataFrame; last column is taken as the class labels
Keyword Args:
bins - Number of bins/quantiles to have for co... | 3.828125 | 4 |
qzzzme_app/urls.py | aboudzein/Qzzz.me-API | 1 | 51491 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Python imports.
import logging
# Django imports.
from django.conf.urls import url
# Rest Framework imports.
# Third Party Library imports
# local imports.
from qzzzme_app.swagger import schema_view
app_name = 'qzzzme_app'
urlp... | 1.265625 | 1 |
conopy/browser.py | sshmakov/conopy | 5 | 51492 | <reponame>sshmakov/conopy<filename>conopy/browser.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
import PyQt5
import os
class WebWin(QWebEngineView):
def __init__(self, iniFile, parent=None):
super(WebWin, self... | 2.125 | 2 |
external/snake-0.3/snake/ibamr/plotField2dVisIt.py | mesnardo/cuIBM | 67 | 51493 | <reponame>mesnardo/cuIBM
"""
Calls VisIt in batch mode to generate .png files of the 2D field contour.
cli: visit -nowin -cli -s plotField2dVisIt.py <arguments>
"""
import os
import sys
import math
import argparse
sys.path.append(os.environ['SNAKE'])
from snake import miscellaneous
def parse_command_line():
"""
... | 2.734375 | 3 |
Lifestyle/githubzen.1m.py | uberfastman/bitbar-plugins | 0 | 51494 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <bitbar.title>GitHub Zen</bitbar.title>
# <bitbar.version>v1.0.0</bitbar.version>
# <bitbar.author>Josh</bitbar.author>
# <bitbar.author.github>andjosh</bitbar.author.github>
# <bitbar.desc>GitHub zen in your menu bar!</bitbar.desc>
# <bitbar.dependencies>python</bitbar.... | 2.234375 | 2 |
cogs/rpg.py | iomintz/beattie | 0 | 51495 | <gh_stars>0
import asyncio
import os
import random
import re
from concurrent import futures
from typing import List, Sequence, Tuple
import discord
from discord.ext import commands
from discord.ext.commands import Cog
from bot import BeattieBot
from context import BContext
from utils.genesys import die_names, genesys... | 2.6875 | 3 |
symopt/optimization_functions/goldenSearch.py | rafaelpsilva07/symopt | 2 | 51496 | from multiprocessing.sharedctypes import Value
import sympy as sp
a = sp.symbols('alpha')
def _phase2golden(alpha_l, alpha_u, functionOfAlpha, error, k, debug): #implementação do SLIDE 13
currentError = error + 1 # força o algorítimo a passar para o loop while
k += 1
while abs(currentError) > ... | 3.15625 | 3 |
demo/evaluation/SP_GoogLeNet.py | ntoussaint/SPN.pytorch | 228 | 51497 | <reponame>ntoussaint/SPN.pytorch<filename>demo/evaluation/SP_GoogLeNet.py<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function, Variable
from torch.utils.serialization import load_lua
from spn import SoftProposal, SpatialSumOverMap, hook_spn, unh... | 2.3125 | 2 |
crypto_crawler/strategy.py | stargrep/crypto_cralwer | 5 | 51498 | <filename>crypto_crawler/strategy.py<gh_stars>1-10
import numpy as np
from sklearn.metrics import mean_squared_error
from statsmodels.tsa.arima_model import ARIMA
from crypto_crawler.const import TRANS_FEE_PERCENTAGE_AVG, SELECT_CRYPTO_RECENT_500
from crypto_crawler.data_model import CryptoPrice
from crypto_crawler.re... | 2.671875 | 3 |
http_server.py | redfast00/malidate | 33 | 51499 | <filename>http_server.py
from server import DBPool
from twisted.web import server, resource
from twisted.web.server import NOT_DONE_YET
from twisted.internet import reactor
import time
import json
class HTTPServer(resource.Resource):
isLeaf = True
def render(self, request):
# print(dir(request))
... | 2.5 | 2 |