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 |
|---|---|---|---|---|---|---|
Convert_a_Number_to_Hexadecimal.py | thydeyx/LeetCode-Python | 1 | 12765751 | <gh_stars>1-10
# -*- coding:utf-8 -*-
#
# Author : TangHanYi
# E-mail : <EMAIL>
# Create Date : 2016-11-21 04:35:06 PM
# Last modified : 2016-11-21 04:51:12 PM
# File Name : Convert_a_Number_to_Hexadecimal.py
# Desc :
class Solution(object):
def toHex(self, num):
if num == 0:
return "... | 3.578125 | 4 |
FLASH4.2.1_save/tools/python/flmake/log.py | mtsafarzadeh/FLASHverES | 1 | 12765752 | <reponame>mtsafarzadeh/FLASHverES
import os
from datetime import datetime
USAGE = ("Displays the history of all (or N) previously\n"
"executed flmake commands and their metadata.\n\n"
"usage: flmake log [-n <N>]")
def _parse_row(row):
t, cmd, user, logid, runid, d, msg = row.split(',', 6)
re... | 2.890625 | 3 |
tests/fixtures/config_teamocil/test1.py | rfoliva/tmuxp | 1,607 | 12765753 | <reponame>rfoliva/tmuxp<filename>tests/fixtures/config_teamocil/test1.py
from .._util import loadfixture
teamocil_yaml = loadfixture('config_teamocil/test1.yaml')
teamocil_conf = {
'windows': [
{
'name': 'sample-two-panes',
'root': '~/Code/sample/www',
'layout': 'even-ho... | 1.625 | 2 |
tests/unit/test_workspace.py | triton-inference-server/model_navigator | 49 | 12765754 | <reponame>triton-inference-server/model_navigator
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... | 2.265625 | 2 |
src/lib/Bcfg2/Client/Tools/POSIX/Device.py | stpierre/bcfg2 | 0 | 12765755 | <reponame>stpierre/bcfg2
import os
import sys
try:
from base import POSIXTool, device_map
except ImportError:
# py3k, incompatible syntax with py2.4
exec("from .base import POSIXTool, device_map")
class POSIXDevice(POSIXTool):
__req__ = ['name', 'dev_type', 'perms', 'owner', 'group']
def fully_spe... | 2.328125 | 2 |
buyfree_mall/buyfree_mall/apps/users/constants.py | GalphaXie/E-commerce | 0 | 12765756 | <gh_stars>0
# -*- coding: utf-8 -*-
# @File : constants.py
# @Author : Xie
# @Date : 9/15/18
# @Desc :
# email验证的过期时间
VERIFY_EMAIL_TOKEN_EXPIRES = 24 * 60 * 60
# 每个用户收货地址界面显示的最大地址数量
USER_ADDRESS_COUNTS_LIMIT = 20
# 用户浏览记录最大展示数量
USER_BROWSING_HISTORY_COUNTS_LIMIT = 5
| 1.070313 | 1 |
anaplanapi2/AnaplanConnection.py | response4amit/anaplanapi2 | 0 | 12765757 | <reponame>response4amit/anaplanapi2
#===============================================================================
# Created: 22 May 2019
# @author: AP (adapated from <NAME>)
# Description: Class to contain Anaplan connection details required for all API calls
# Input: Authorization header s... | 2.484375 | 2 |
Player.py | Vrim/TicTacToe | 0 | 12765758 | <filename>Player.py
from __future__ import annotations
from typing import Any, Tuple, List
class Player():
""" Tic Tac Toe
Author: <NAME>
Date: Oct. 11, 2019
----- Player -----
Player class represents the Player(s)
Keeps track of Players in the game and their scores, symbols, names.
"""
symbol: str
name: st... | 3.65625 | 4 |
tests/hosting/test_messages.py | DaeunYim/pgtoolsservice | 33 | 12765759 | <gh_stars>10-100
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------------... | 2.640625 | 3 |
main.py | EroCallie/PSPrintChat | 0 | 12765760 | <filename>main.py
#!/usr/bin/env python
import PlexLib
import time
import calendar
class PrintChat:
@staticmethod
def on_message(channel, message):
utctime = time.strptime(message['date'], '%Y-%m-%dT%H:%M:%S+00:00')
timestamp = time.strftime("%H:%M:%S", time.localtime(calendar.timegm(utctime)... | 2.515625 | 3 |
twitchstreams/apps.py | naelstrof/PugBot-Discord-Django | 3 | 12765761 | <filename>twitchstreams/apps.py
from django.apps import AppConfig
class TwitchstreamsConfig(AppConfig):
name = 'twitchstreams'
| 1.257813 | 1 |
leetcode/1022.py | sputnikW/algorithm | 0 | 12765762 | <reponame>sputnikW/algorithm
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def sumRootToLeaf(self, root: TreeNode) -> int:
if root is None:
return 0
sum =... | 3.734375 | 4 |
utils.py | Chrisae9/youtube-trending-prediction | 0 | 12765763 | <filename>utils.py
from textblob import TextBlob
from dateutil import parser
import random
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
def classifiedTextblob(data):
polar = TextBlob(data).sentiment.polarity
if (polar < 0):
return -1
if (polar == 0):
return 0
if ... | 3 | 3 |
flask_ecom_api/api/v1/customers/models.py | savilard/flask-ecom-api | 1 | 12765764 | from sqlalchemy_utils import EmailType, PhoneNumberType
from flask_ecom_api.api.v1.customers.admin import (
CustomerAdminView,
CustomerShippingAddressAdminView,
)
from flask_ecom_api.api.v1.orders.models import Order
from flask_ecom_api.app import admin, db
class Customer(db.Model):
"""Customer model."""... | 2.796875 | 3 |
tests/factories/net.py | marcelb98/pycroft | 0 | 12765765 | import factory
from ipaddr import IPv4Network
from pycroft.model.net import VLAN, Subnet
from tests.factories.base import BaseFactory
class VLANFactory(BaseFactory):
class Meta:
model = VLAN
name = factory.Sequence(lambda n: "vlan{}".format(n+1))
vid = factory.Sequence(lambda n: n+1)
class Sub... | 2.453125 | 2 |
fedml_api/hook_test.py | SlimFun/FL_pruning | 0 | 12765766 | import torch
x = torch.Tensor([0, 1, 2, 3]).requires_grad_()
y = torch.Tensor([4, 5, 6, 7]).requires_grad_()
w = torch.Tensor([1, 2, 3, 4]).requires_grad_()
z = x+y
def hook_fn(grad):
print(grad)
handle_1 = z.register_hook(hook_fn)
o = w.matmul(z)
def hook_fn2(grad):
print('grad')
handle_2 = z.register_ho... | 2.8125 | 3 |
adv/botan.py | qwewqa/dl | 0 | 12765767 | import adv.adv_test
from core.advbase import *
from module.bleed import Bleed
from slot.a import *
from slot.d import *
def module():
return Botan
class Botan(Adv):
# comment = "RR+Jewels"
a3 = ('prep_charge',0.05)
conf = {}
conf['slots.a'] = RR() + BN()
conf['slots.d'] = Shinobi()
conf['ac... | 2.125 | 2 |
pixie_plugin/task_queue/redis_queue.py | bpschmitt/nr-pixie-security-plugin | 0 | 12765768 | <filename>pixie_plugin/task_queue/redis_queue.py
from urllib.parse import urlparse
from redis import Redis
from rq import Queue
def redis_connection(config):
url = urlparse(config["REDIS_URL"])
return Redis(host=url.hostname, port=url.port, password=config["REDIS_PASSWORD"])
def redis_queue(config):
re... | 2.65625 | 3 |
enumeration/util.py | VlachosGroup/AdsorptionConfiguration_MS2021 | 0 | 12765769 | <reponame>VlachosGroup/AdsorptionConfiguration_MS2021<filename>enumeration/util.py<gh_stars>0
import numpy as np
from rdkit import Chem
from rdkit.Chem import rdqueries, rdForceFieldHelpers
from rdkit.Chem.rdChemReactions import ChemicalReaction
from collections import defaultdict
from itertools import combinations
fro... | 2.046875 | 2 |
accounts/models.py | igemsoftware/HFUT-China_2015 | 0 | 12765770 | from django.db import models
import datetime
# Create your models here.
class User(models.Model):
username = models.CharField(max_length=16, primary_key=True)
password = models.CharField(max_length=64)
email = models.EmailField()
is_confirmed = models.BooleanField()
def __unicode__(self):
... | 2.421875 | 2 |
part/utils.py | chdemko/py-part | 0 | 12765771 | """Utility module that defines the :class:`Singleton` class."""
class Singleton:
"""
Singleton class.
The :class:`Singleton` class is used to force a unique instantiation.
"""
_instance = None
def __new__(cls, *args) -> "Singleton":
"""Control single instance creation."""
if... | 3.421875 | 3 |
LabVIEWCode/Subs/pySerial/RogersSerial.py | EricYufengWu/Summer2020 | 0 | 12765772 | import serial,time
ser = None
def InitSerial(port,baudrate,timeout):
global ser
reply = 'None'
try:
ser = serial.Serial(port,baudrate = baudrate,timeout = timeout) # open serial port
except Exception as e:
reply = e
return reply
def N_Serial():
global ser
n = ser.inWaiti... | 2.8125 | 3 |
athena/tools/process_decode_result.py | leixiaoning/Athena-Giga | 0 | 12765773 | # coding=utf-8
# Copyright (C) 2020 ATHENA AUTHORS; <NAME>
# 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
#... | 2.265625 | 2 |
bindings/cython/examples/brain_highres.py | djhoese/datoviz | 0 | 12765774 | """
# 3D high-res brain mesh
Showing a ultra-high resolution mesh of a human brain, acquired with a 7 Tesla MRI.
The data is not yet publicly available.
Data courtesy of <NAME> et al.:
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, <NAME>, <NAME> and <NAME> (2020)
... | 2.34375 | 2 |
files/download/lib/mwbot.py | ikn/ikn.org.uk | 0 | 12765775 | """A MediaWiki browser and editor.
These are functions to fetch and process data from, and make changes to,
MediaWiki installations. Everything is done through the Wiki class.
Python version: 2.
Release: 6.
Licensed under the GNU Lesser General Public License, version 3; if this was
not included, you can find it he... | 3.078125 | 3 |
api/example_3.py | cfe-lab/Kive | 2 | 12765776 | """Create and use a dataset using an external file.
Note that this example:
- Only works when it's run on the same host as the Kive server and Kive worker
(e.g. in the `dev-env` environment). On a production server, external files
are kept in a network share, so they can be accessed from different hosts.
- Requi... | 2.90625 | 3 |
djangoapp/migrations/0007_auto_20170607_0426.py | Laure129/findheadposes | 0 | 12765777 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-06-07 01:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangoapp', '0006_remove_gallery_slug'),
]
operations = [
migrations.AlterFie... | 1.40625 | 1 |
mantle_simulation/LAB.py | Johnson-A/UNM_Research | 4 | 12765778 | <reponame>Johnson-A/UNM_Research<filename>mantle_simulation/LAB.py<gh_stars>1-10
from dolfin import tanh, sqrt
from constants import mesh_width, mesh_height
keel_width = 0.2 * mesh_width
scale = keel_width / 4
LAB_height = 0.75 * mesh_height
keel_height = mesh_height / 8
def ridge(r, offset):
return 1.0 - tanh... | 2.421875 | 2 |
noxfile.py | stbraun/loganalyzer | 0 | 12765779 | # coding=utf-8
""" Configuration of nox test automation tool. """
import nox
@nox.session(python=['3.8', '3.9'])
def lint(session):
"""Run static analysis."""
session.run("pipenv", "install", "--dev", external=True)
session.run("pipenv", "run", "flake8", "loganalysis/", "tests/")
@nox.session(python=['... | 1.859375 | 2 |
api/migrations/0003_auto_20170129_1135.py | LuchaComics/comicscantina-django | 0 | 12765780 | <filename>api/migrations/0003_auto_20170129_1135.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2017-01-29 11:35
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
depen... | 1.585938 | 2 |
StripeCaller/caller/StripeCaller.py | seanpatrickmoran/StripeCaller | 0 | 12765781 | <reponame>seanpatrickmoran/StripeCaller
import sys
sys.path.append("..")
from utils.load_HiC import *
from .functions import enrichment_score2, find_max_slice, phased_max_slice_arr, merge_positions, get_stripe_and_widths
from .mat_ops import strata2vertical, strata2horizontal, blank_diagonal_sparse_from_strata, blank_d... | 1.734375 | 2 |
interactions/util.py | Bhaskers-Blu-Org2/SARA | 78 | 12765782 | <reponame>Bhaskers-Blu-Org2/SARA<filename>interactions/util.py
# coding=utf8
import json
ACTIVITY_TAG = '[Activity]'
DIALOG_TAG = '[Dialog]'
POPUPWINDOW_TAG = '[PopupWindow]'
VIEW_TAG = '[ViewOnTouchEvent]'
EDITABLE_INPUT_CONNECTION_TAG = '[EditableInputConnection]'
SPANNER_STRING_BUILDER_TAG = '[SpannerStringBuilde... | 1.8125 | 2 |
Task2C.py | mavevor/flood-warning-system | 0 | 12765783 | from floodsystem.stationdata import build_station_list,update_water_levels
from floodsystem.flood import stations_highest_rel_level
def run():
stations = build_station_list()
update_water_levels(stations)
N = 10
a = stations_highest_rel_level(stations, N)
for i in a:
print("{}, {}".format(i... | 2.921875 | 3 |
brainfeed.py | martinpflaum/bachelor_thesis | 0 | 12765784 | <gh_stars>0
"""
MIT License
Copyright (c) 2021 martinpflaum
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,... | 1.851563 | 2 |
kmeans-vae/utils/misc.py | darylperalta/computer-vision | 8 | 12765785 | <reponame>darylperalta/computer-vision
'''Some helper functions for PyTorch, including:
- get_mean_and_std: calculate the mean and std value of dataset.
- msr_init: net parameter initialization.
- progress_bar: progress bar mimic xlua.progress.
'''
import numpy as np
import torch
import torch.nn as nn
impor... | 3.1875 | 3 |
MoTrack Therapy Mac/MoTrack Therapy Mac/photos/photo_renaming/rename_data_images_files_v2.py | ryerrabelli/MoTrackTherapyMobilePublic | 2 | 12765786 | #<NAME>
#MoTrack Therapy
#Created Mon Oct 14, 2019
#GOAL: Convert standard iOS file names ("IMG_1750.JPG") to MoTrack data image standard names ("IMG_0001_A_RAW.JPG").
#Description:
#Doesn't rename the files in place in case there is a bug. Instead takes input images in one folder, and makes output in another folder
#A... | 2.796875 | 3 |
movies-apis/custom-recipes/movies-apis-omdb-details/recipe.py | acloudfrontier/dataiku-contrib | 1 | 12765787 | import pandas as pd
import requests
import dataiku
from dataiku.customrecipe import *
input_dataset = dataiku.Dataset(get_input_names_for_role('input_dataset')[0])
lookup_col = get_recipe_config().get('title_col','')
lookup_name = 'title_queried'
if lookup_col != '':
use_id = False
else:
use_id = True
loo... | 2.703125 | 3 |
WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/Overflow/Beginners-Python-Examples-master/square_root_algorithm.py | webdevhub42/Lambda | 5 | 12765788 | <filename>WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/Overflow/Beginners-Python-Examples-master/square_root_algorithm.py
""" Function uses prime factorisation method
to find square root of number """
def prime_factors(c):
pos = 2
factors = []
while (pos <= c):
if (c % pos == 0):
c = c // pos
factors.a... | 4.09375 | 4 |
postgrest/constants.py | bariqhibat/postgrest-py | 34 | 12765789 | DEFAULT_POSTGREST_CLIENT_HEADERS = {
"Accept": "application/json",
"Content-Type": "application/json",
}
DEFAULT_POSTGREST_CLIENT_TIMEOUT = 5
| 1.03125 | 1 |
tests/test_basic.py | zackw/pyamf | 14 | 12765790 | # -*- encoding: utf-8 -*-
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
General tests.
@since: 0.1.0
"""
from __future__ import absolute_import
import six
from types import ModuleType
import unittest
import miniamf
from .util import ClassCacheClearingTestCase, replace_dict, Spam
class ASO... | 2.578125 | 3 |
apps/main/migrations/0005_auto_20180213_2216.py | andrewixl/peopleshop | 0 | 12765791 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-02-14 06:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0004_apparel_shipping'),
]
operations = [
migrations.Ad... | 1.671875 | 2 |
src/get.causal.v2b.py | gxiaolab/cGMAS | 1 | 12765792 | <reponame>gxiaolab/cGMAS<filename>src/get.causal.v2b.py
#!/usr/bin/python
import sys
import argparse
import glob
from time import strftime
import os
import time
from collections import defaultdict
import numpy as np
###########
# If 1 candid causal snv has multiple tags, need to make sure all the candid-tag pairs are... | 2.125 | 2 |
scripts/check_license.py | SanctuaryComponents/layer_management | 1 | 12765793 | #!/usr/bin/python
###########################################################################
#
# Copyright 2013 BMW Car IT GmbH
#
# 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
#
# ht... | 2.578125 | 3 |
pbrl/algorithms/dqn/policy.py | jjccero/rliccd | 3 | 12765794 | <reponame>jjccero/rliccd<filename>pbrl/algorithms/dqn/policy.py<gh_stars>1-10
import copy
from typing import Optional, List, Type
import numpy as np
import torch
from gym.spaces import Space
from pbrl.algorithms.dqn.net import QNet
from pbrl.policy.policy import BasePolicy
class Policy(BasePolicy):
def __init__(... | 1.992188 | 2 |
Problems/Binary Tree/236. Lowest Common Ancestor of a Binary Tree.py | BYJRK/LeetCode-Solutions | 0 | 12765795 | <gh_stars>0
# https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/
class TreeNode:
def __init__(self, x, left=None, right=None):
self.val = x
self.left = left
self.right = right
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeN... | 3.484375 | 3 |
feature_selection/tests/check_test.py | gonzalesMK/MetaHeuristic | 12 | 12765796 | import numpy as np
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.testing import assert_array_equal
from sklearn.datasets import load_breast_cancer
from sklearn.svm import SVC
from feature_selection import HarmonicSearch
from feature_selection import GeneticAlgorithm
from feature_selectio... | 2.3125 | 2 |
pyrep/objects/vision_sensor.py | WeiWeic6222848/PyRep | 505 | 12765797 | import math
from typing import List, Union, Sequence
from pyrep.backend import sim
from pyrep.objects.object import Object, object_type_to_class
import numpy as np
from pyrep.const import ObjectType, PerspectiveMode, RenderMode
class VisionSensor(Object):
"""A camera-type sensor, reacting to light, colors and ima... | 2.5 | 2 |
tools/build_defs/shell_toolchain/polymorphism/generate_overloads.bzl | bshi/rules_foreign_cc | 0 | 12765798 | <reponame>bshi/rules_foreign_cc
# buildifier: disable=module-docstring
def _provider_text(symbols):
return """
WRAPPER = provider(
doc = "Wrapper to hold imported methods",
fields = [{}]
)
""".format(", ".join(["\"%s\"" % symbol_ for symbol_ in symbols]))
def _getter_text():
return """
def id_from_file(fil... | 2.171875 | 2 |
utilityhelper/common/HelperMagic.py | leileigong/utility-helper | 0 | 12765799 | <reponame>leileigong/utility-helper
#coding:utf-8
from __future__ import (print_function, unicode_literals)
def wrapper_round_n_float(radix):
def flyable_to_return(cls):
def r(self, num):
return round(num, radix)
cls.r = r
return cls
return flyable_to_return
@wrapper_round_... | 3.09375 | 3 |
NetworkTracerouteCollector.py | djw8605/ps-ingest | 0 | 12765800 | #!/usr/bin/env python
import os
import time
import copy
import json
from datetime import datetime
import threading
import collector
import siteMapping
class NetworkTracerouteCollector(collector.Collector):
def __init__(self):
self.TOPIC = "/topic/perfsonar.raw.packet-trace"
self.INDEX_PREFIX =... | 2.171875 | 2 |
utils/files.py | phenmp/atassist-api | 0 | 12765801 | from os.path import dirname, join, isfile
# Constants
PROJECT_ROOT_DIRECTORY = dirname(dirname(__file__))
DUMP_FILE_SUFFIX = "_dump.csv"
def getFullPath(*path):
return join(PROJECT_ROOT_DIRECTORY, *path)
def getUserLastDumpFilePath(userId):
return getFullPath('resources', 'dump_files', "{0}{1}".format(userId... | 3.046875 | 3 |
beastx/modules/sangmata.py | Digasi123percy/Beast-X | 11 | 12765802 | <reponame>Digasi123percy/Beast-X
import datetime
#team mates @danish_00,@Shivam_Patel,@xditya,@The_Siddharth_Nigam
from telethon import events
#team mates @danish_00,@Shivam_Patel,@xditya,@The_Siddharth_Nigam
from telethon.errors.rpcerrorlist import YouBlockedUserError
#team mates @danish_00,@Shivam_Patel,@xditya,@The_... | 2.109375 | 2 |
utils/mahalanobis.py | gautard/pystatsml | 123 | 12765803 | <reponame>gautard/pystatsml<filename>utils/mahalanobis.py
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 4 16:09:56 2016
@author: <EMAIL>
"""
import numpy as np
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
#%matplotlib inline
'''
Mahalanobis distance
====================
'''
from matplotlib.pa... | 2.90625 | 3 |
array/0074_search_a_2d_matrix/0074_search_a_2d_matrix.py | zdyxry/LeetCode | 6 | 12765804 | class Solution(object):
def searchMatrix(self, matrix, target):
if not matrix or target is None:
return False
rows, cols = len(matrix), len(matrix[0])
low, high = 0, rows* cols - 1
while low <= high:
mid = (low + high) / 2
num = matrix[mid / cols... | 3.6875 | 4 |
src/MathewTrainer.py | akshaybahadur21/MathEw | 10 | 12765805 | from keras.callbacks import ModelCheckpoint
from keras.layers import Dense, Flatten, Conv2D
from keras.layers import MaxPooling2D, Dropout
from keras.models import Sequential
from keras.preprocessing.image import ImageDataGenerator
from src.utils.train_utils import post_process
class MathewTrainer:
def __init__(s... | 3.015625 | 3 |
python-pyqt/Section01/unit03-QMainWindow/01.py | sharebook-kr/learningspoons-bootcamp-finance | 9 | 12765806 | import sys
from PyQt5.QtWidgets import *
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
self.resize(400, 300)
self.move(300, 300)
app = QApplication(sys.argv)
win = MyWindow()
win.show()
app.exec_() | 2.53125 | 3 |
src/python/twitter/checkstyle/plugins/trailing_whitespace.py | zhouyijiaren/commons | 1,143 | 12765807 | # ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | 2.09375 | 2 |
examples/amoebot/amoebot_sim.py | csningli/MultiAgent | 1 | 12765808 | <filename>examples/amoebot/amoebot_sim.py<gh_stars>1-10
# MultiAgent 2.0
# (c) 2017-2018, NiL, <EMAIL>
import sys, random, datetime, math
random.seed(datetime.datetime.now())
sys.path.append("../..")
from mas.multiagent import *
from mas.utils import *
amoebot_radius = 10.0
def pq_to_xy(a) :
b = array([0.0, 0... | 2.59375 | 3 |
Examples/InteractiveTutorial/MeasureRegions.py | SimpleITK/SimpleITK-MICCAI-2011-Tutorial | 25 | 12765809 | import SimpleITK as sitk
import csv
# Load the Images to be measured
ScalarValuesFile = '~/SimpleITK-MICCAI-2011-Tutorial/Data/FA.png'
ScalarValuesImage = sitk.Cast( sitk.ReadImage(ScalarValuesFile), sitk.sitkUInt32 )
sitk.Show ( ScalarValuesImage )
LabelMapFile = '~/SimpleITK-MICCAI-2011-Tutorial/Data/LB.png'
LabelM... | 2.59375 | 3 |
map_label_tool/py_proto/modules/v2x/proto/v2x_service_obu_to_car_pb2.py | freeclouds/OpenHDMap | 0 | 12765810 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/v2x/proto/v2x_service_obu_to_car.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pro... | 1.28125 | 1 |
FMPNet.py | ParadoxZW/CIFAR100-PRACTICE | 1 | 12765811 | <filename>FMPNet.py
# it doesn't work, still need debugging.
# But I'm not interesting in this architecture any more.
# So I just keep the code there
from modules import FMPBlock, LayerNorm
from torch import tensor
import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
class DropoutFMP(... | 2.59375 | 3 |
moflow/mf/reader.py | mwtoews/moflow | 1 | 12765812 | import os
import numpy as np
import re
import sys
try:
import h5py
except ImportError:
h5py = None
'''
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
'''
from .. import logger, logging
from .base import MFPackage, MissingFile
from .name import Modflow
... | 2.328125 | 2 |
Generator/DSLNode.py | Dev-Tarek/sketched-webpages-generator | 35 | 12765813 | import sys, os
from .DSL_GRAPH import graph
class DSLNode:
def __init__(self, key, parent):
self.key = key
self.parent = parent
self.children = []
def addChild(self, child):
self.children.append(child)
def render(self, file, level):
if self.key ==... | 2.859375 | 3 |
python/leetcode/86.py | ParkinWu/leetcode | 0 | 12765814 | <filename>python/leetcode/86.py
# 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。
#
# 你应当保留两个分区中每个节点的初始相对位置。
#
# 示例:
#
# 输入: head = 1->4->3->2->5->2, x = 3
# 输出: 1->2->2->4->3->5
from typing import List
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
se... | 3.671875 | 4 |
gpkitmodels/GP/aircraft/prop/prop_test.py | aeroa/gpkit-models | 11 | 12765815 | <reponame>aeroa/gpkit-models<gh_stars>10-100
" propeller tests "
from gpkitmodels.GP.aircraft.prop.propeller import Propeller, ActuatorProp
from gpkitmodels.SP.aircraft.prop.propeller import BladeElementProp
from gpkitmodels.GP.aircraft.wing.wing_test import FlightState
from gpkit import units, Model
def simpleprop_t... | 2.34375 | 2 |
08-def-type-hints/comparable/mymax_demo.py | hdcpereira/example-code-2e | 1 | 12765816 | from typing import TYPE_CHECKING, List, Optional
import mymax as my
def demo_args_list_float() -> None:
args = [2.5, 3.5, 1.5]
expected = 3.5
result = my.max(*args)
print(args, expected, result, sep='\n')
assert result == expected
if TYPE_CHECKING:
reveal_type(args)
reveal_type... | 3.4375 | 3 |
api/rf_temps/rf_stream.py | barretobrock/server-tools | 1 | 12765817 | <filename>api/rf_temps/rf_stream.py
import subprocess
from kavalkilu import LogWithInflux, HOME_SERVER_HOSTNAME, Hosts
logg = LogWithInflux('rf_stream', log_dir='rf')
serv_ip = Hosts().get_ip_from_host(HOME_SERVER_HOSTNAME)
cmd = ['/usr/local/bin/rtl_433', '-F', f'syslog:{serv_ip}:1433']
logg.info(f'Sending command:... | 2.078125 | 2 |
alchemy/admin_server/external_services.py | edu-gp/annotation_tool | 2 | 12765818 | import logging
from google.cloud import pubsub
from google.cloud import secretmanager
class GCPPubSubService:
_client = None
@classmethod
def get_client(cls):
if cls._client is None:
cls._client = pubsub.PublisherClient()
return cls._client
@classmethod
def publish_m... | 2.359375 | 2 |
label_studio/storage/dbStorageSource.py | smrandhawa/label-studio | 0 | 12765819 | <reponame>smrandhawa/label-studio
from .base import BaseStorage
import logging
import os
from label_studio.models import Task, Completion, StageRobin
from label_studio import db
from label_studio.utils.io import json_load
from sqlalchemy import func
import json
logger = logging.getLogger(__name__)
# def checkAndgetT... | 1.960938 | 2 |
see_rnn/utils.py | MichaelHopwood/MLMassSpectrom | 149 | 12765820 | <filename>see_rnn/utils.py
import numpy as np
from copy import deepcopy
from pathlib import Path
from ._backend import WARN, NOTE, TF_KERAS, Layer
try:
import tensorflow as tf
except:
pass # handled in __init__ via _backend.py
TF24plus = bool(float(tf.__version__[:3]) > 2.3)
def _kw_from_configs(configs, d... | 2.125 | 2 |
FigureTable/ChordDiagram/corre.py | vkola-lab/multi-task | 0 | 12765821 | import numpy as np
import scipy
import scipy.stats
import csv
scores = np.load('regional_avgScore_nAD.npy')
print(scores.shape)
pool = [[0 for _ in range(scores.shape[1])] for _ in range(scores.shape[1])]
for i in range(scores.shape[1]-1):
for j in range(i+1, scores.shape[1]):
corr, _ = scipy.stats.pears... | 2.5625 | 3 |
MetaScreener/external_sw/mgltools/MGLToolsPckgs/AutoDockTools/GridParameters.py | bio-hpc/metascreener | 8 | 12765822 | <gh_stars>1-10
## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by
#############################################################################
#
# Author: <NAME>, <NAME>
#
# Copyright: <NAME> TSRI 2000
#
#############################################################################
# $Header: /opt/cvs/p... | 1.851563 | 2 |
pacman.py | Xevaquor/aipac | 0 | 12765823 | #!/usr/bin/env python
# coding=utf-8
__author__ = 'Xevaquor'
__license__ = 'MIT'
from layout import *
from copy import deepcopy
Moves = {
'North' : (0, -1),
'South' : (0, 1),
'East': (1, 0),
'West' : (-1, 0),
'Stop' : (0, 0)
}
class AgentStatus(object):
def __init__(self, pos = (0,0), scared... | 3.34375 | 3 |
aia_project/main.py | maciejczyzewski/sem6 | 0 | 12765824 | <reponame>maciejczyzewski/sem6
import unittest
from flask_script import Manager, Command
from test import create_test_suite
from app import Service
service = Service()
service.start()
############################################
"""
from celery import Celery
CELERY_BROKER_BACKEND = "db+sqlite:///celery.sqlite"
CELE... | 2.546875 | 3 |
deploy/text_classification/Predictor.py | amirgholipour/mlops_project | 0 | 12765825 | import tensorflow as tf
import joblib
import numpy as np
import json
import traceback
import sys
import os
class Predictor(object):
def __init__(self):
self.loaded = False
def load(self):
print("Loading model",os.getpid())
self.model = tf.keras.models.load_model('model.h5', compile... | 2.359375 | 2 |
applications/autocomplete/init.py | Vishakha1990/Lambdas | 0 | 12765826 | <filename>applications/autocomplete/init.py
import rethinkdb as r
import os, os.path, argparse
from common import *
AC = 'ac' # DB
WORDS = 'words' # TABLE
WORD = 'word' # COLUMN
FREQ = 'freq' # COLUMN
NGINX_EXAMPLE = 'docker run -d -p 80:80 -v %s:/usr/share/nginx/html:ro nginx'
def makeDB(host):
conn = r.connect(h... | 2.5625 | 3 |
pypodman/lib/actions/export_action.py | TomSweeneyRedHat/python-pypodman | 1 | 12765827 | <gh_stars>1-10
"""Remote client command for export container filesystem to tarball."""
import sys
import podman
from pypodman.lib import AbstractActionBase
class Export(AbstractActionBase):
"""Class for exporting container filesystem to tarball."""
@classmethod
def subparser(cls, parent):
"""Add... | 2.484375 | 2 |
tests/input/test_validators.py | larribas/dagger | 9 | 12765828 | <reponame>larribas/dagger
import pytest
from dagger.input.from_node_output import FromNodeOutput
from dagger.input.from_param import FromParam
from dagger.input.validators import (
_clean_parameters,
_validate_parameters,
split_required_and_optional_inputs,
validate_and_clean_parameters,
validate_n... | 2.328125 | 2 |
authentik/core/migrations/0021_alter_application_slug.py | BeryJu/passbook | 15 | 12765829 | # Generated by Django 3.2.3 on 2021-05-14 08:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("authentik_core", "0020_source_user_matching_mode"),
]
operations = [
migrations.AlterField(
model_name="application",
... | 1.617188 | 2 |
libs/urllibs/setlog.py | Evelca1N/K-Spider | 3 | 12765830 | # !/usr/bin/dev python
# -*- coding:utf-8 -*-
from datetime import datetime
import sys
def LogFile(logFile, target_url):
filePoint = open('{}'.format(logFile), 'a')
filePoint.write('----------------------------\n\n')
for i in sys.argv:
filePoint.write(i + ' ')
filePoint.write('\n')
filePo... | 2.90625 | 3 |
photo-page/getImgHTML.py | alex-law/personal-website | 0 | 12765831 | <reponame>alex-law/personal-website
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 15:26:52 2020
@author: alexw
"""
import os
out = '<div class="col-sm-12 col-md-4">\n<a class="lightbox" href="img/1.jpg">\n<img src="img/1.jpg" alt="1">\n</a>\n</div>\n'
for n in range(2, 139):
base = '<div class="col-sm-12 col... | 2.34375 | 2 |
src/util/plot.py | ivarbrek/master_thesis_bestemt | 0 | 12765832 | import matplotlib.pyplot as plt
from typing import List, Tuple, Dict
import pandas as pd
import plotly.graph_objects as go
def plot_alns_history(solution_costs: List[Tuple[int, int]], lined: bool = False, legend: str = "") -> None:
x, y = zip(*solution_costs)
plt.figure(figsize=(10, 7)) # (8, 6) is default
... | 2.703125 | 3 |
morse_hospital_sim/src/turtlebot_hospital_sim/Turtlebot.py | gabrielsr/hmrs_hospital_simulation | 0 | 12765833 | <reponame>gabrielsr/hmrs_hospital_simulation
import json
import rospy
import geometry_msgs.msg
from morse.builder import *
from threading import Timer
from std_msgs.msg import String
from turtlebot_hospital_sim.BatterySensor import BatterySensor
from turtlebot_hospital_sim.ItemExchanger import ItemExchanger
# import tf... | 2.265625 | 2 |
ozone-framework-python-server/config/serializers.py | aamduka/ozone | 6 | 12765834 | <filename>ozone-framework-python-server/config/serializers.py
from django.contrib.auth import authenticate
from rest_framework import serializers
class LoginSerializer(serializers.Serializer):
username = serializers.CharField()
password = serializers.CharField()
def validate(self, attrs):
user = ... | 2.4375 | 2 |
stanfordnlp/pipeline/ner_processor.py | msinkec/classla-stanfordnlp | 0 | 12765835 | """
Processor for performing named entity tagging.
"""
from stanfordnlp.models.common.pretrain import Pretrain
from stanfordnlp.models.common import doc
from stanfordnlp.models.common.utils import unsort
from stanfordnlp.models.ner.data import DataLoader
from stanfordnlp.models.ner.trainer import Trainer
from stanford... | 2.40625 | 2 |
setup.py | nyuspc/ppt_maker | 0 | 12765836 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="ppt_maker",
version="0.0.1",
author="<NAME>, <NAME>",
author_email="<EMAIL>",
description="Make PowerPoint slides with template and data",
long_description=long_descr... | 1.484375 | 1 |
MP/11_get_binary_atom_type_mask.py | L-sky/Master_Thesis | 0 | 12765837 | import os
import argparse
import numpy as np
import pymatgen
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("mp_dir", help="Root directory with Materials Project dataset")
parser.add_argument("radial_cutoff", type=float, help="Radius of sphere that decides neighborhood")
args = parser.pa... | 2.453125 | 2 |
solvate/__init__.py | michaltykac/SolvateAminoAcids | 1 | 12765838 | <reponame>michaltykac/SolvateAminoAcids
# -*- coding: UTF-8 -*-
# \file __init__.py
# \brief This file initialises the package.
#
# This file firstly denotes this folder as containing python package and secondly it makes some of the solvate
# parts easily accessible.
#
# Copyright by the Authors and individua... | 1.273438 | 1 |
conftest.py | Mozilla-GitHub-Standards/6a6c1dd41e911a7e844c50d56b45288b640f5e21ce6a106042d9f792986f372c | 3 | 12765839 | <gh_stars>1-10
# Configuration file for running contract-tests
import configparser
import pytest
import ssl
# Hack because of how SSL certificates are verified by default in Python
if hasattr(ssl, '_create_unverified_context'):
ssl._create_default_https_context = ssl._create_unverified_context
def pytest_addopti... | 2.09375 | 2 |
mxlive/lims/migrations/0060_auto_20200717_1331.py | katyjg/mxlive | 0 | 12765840 | # Generated by Django 3.0.6 on 2020-07-17 19:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lims', '0059_auto_20200717_1318'),
]
operations = [
migrations.RenameField(
model_name='supportrecord',
old_name='user',
... | 1.570313 | 2 |
lobpy/datareader/lobster.py | bohblue2/lobpy | 0 | 12765841 | """
Copyright (c) 2018, University of Oxford, Rama Cont and ETH Zurich, <NAME>
This module provides the helper functions and the class LOBSTERReader, a subclass of OBReader to read in limit order book data in lobster format.
"""
######
# Imports
######
import csv
import math
import warnings
import numpy as np
fr... | 3.078125 | 3 |
scripts/setup-xbee.py | jamesleesaunders/pi-alertme | 16 | 12765842 | <filename>scripts/setup-xbee.py
#!/usr/bin/python
# coding: utf-8
# Filename: setup-_xbee.py
# Description: Configure XBee
# Author: <NAME> [<EMAIL>]
# Copyright: Copyright (C) 2017 <NAME>
# License: MIT
import serial
from xbee import ZigBee
import pprint
import time
import sys
pp = pprint.PrettyPrinte... | 2.203125 | 2 |
test/test_nvhpc.py | adegomme/hpc-container-maker | 0 | 12765843 | <filename>test/test_nvhpc.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 2.140625 | 2 |
resources/scripts/pytest_otel/docs/demos/test/test_demo.py | and-blk/apm-pipeline-library | 0 | 12765844 | <reponame>and-blk/apm-pipeline-library
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
pytest_plugins = ["pytester"]
import time
import logging
import pytest
def test_basic():
time.sleep(5)
pass
def test_success():
assert True
def test_failure():
assert 1 < 0
def test_... | 1.679688 | 2 |
survey/utils/__init__.py | ericazhou7/uSurvey | 5 | 12765845 | <reponame>ericazhou7/uSurvey
__author__ = 'mnandri'
| 0.875 | 1 |
packages/python/setup.py | ufora/ufora | 571 | 12765846 | <filename>packages/python/setup.py<gh_stars>100-1000
# Copyright 2015 Ufora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | 1.742188 | 2 |
itdagene/app/comments/views.py | itdagene-ntnu/itdagene | 9 | 12765847 | from django.contrib.auth.decorators import permission_required
from django.contrib.messages import ERROR, add_message
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from itdagene.app.comments.forms import CommentForm
from itdagene.app.mail... | 2.046875 | 2 |
PyMOTW/source/sqlite3/sqlite3_date_types.py | axetang/AxePython | 1 | 12765848 | <reponame>axetang/AxePython
#!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2010 <NAME>. All rights reserved.
#
"""Query tasks in the database.
"""
#end_pymotw_header
import sqlite3
import sys
db_filename = 'todo.db'
sql = "select id, details, deadline from task"
def show_deadline(conn):
conn.row_f... | 3.0625 | 3 |
linuxmonitor/routing.py | muthuubalakan/Linux-Monitor | 1 | 12765849 | from django.urls import path
from channels.http import AsgiHandler
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from monitor.consumers import MemoryinfoConsumer
application = ProtocolTypeRouter({
"websocket": AuthMiddlewareStack(
URLRouter([
... | 1.734375 | 2 |
test_tools.py | gonzatorte/sw-utils | 0 | 12765850 |
class SWTestCase:
def __init__(self):
pass
@classmethod
def configure(cls):
pass
def setUp(self):
pass
def tearDown(self):
pass
def run_all_test_case(self):
for test in self.test_to_run:
self.setUp()
test()
self.te... | 2.171875 | 2 |