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 |
|---|---|---|---|---|---|---|
min-blockchain/app/views/blockchain.py | JoMingyu/Blockchain-py | 12 | 12774751 | <reponame>JoMingyu/Blockchain-py
from uuid import uuid4
from flask import Response
from flask_restful import Resource, request
from blockchain.blockchain import Blockchain
blockchain = Blockchain()
class Node(Resource):
def post(self):
"""
Add new node to blockchain
"""
node_id ... | 2.90625 | 3 |
backend/sshwrapper.py | Teknologforeningen/svaksvat | 0 | 12774752 | """
Platform independent ssh port forwarding
Much code stolen from the paramiko example
"""
import select
try:
import SocketServer
except ImportError:
import socketserver as SocketServer
import paramiko
SSH_PORT = 22
DEFAULT_PORT = 5432
class ForwardServer (SocketServer.ThreadingTCPServer):
daemon_thre... | 2.796875 | 3 |
rl/algorithms/qlearning.py | cbschaff/nlimb | 12 | 12774753 | import numpy as np
import tensorflow as tf
from rl.losses import QLearningLoss
from rl.algorithms import OnlineRLAlgorithm
from rl.runner import *
from rl.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer
from rl import util
from deeplearning.layers import Adam, RunningNorm
from deeplearning.schedules import L... | 1.992188 | 2 |
examples/hello_world.py | MartialMad/py-dimensional-analysis | 2 | 12774754 | <gh_stars>1-10
import logging
def main():
import danalysis as da
si = da.standard_systems.SI # predefined standard units
s = da.Solver(
{
'a' : si.M, # [a] is mass
'b' : si.L*si.M*si.T**-2, # [b] is force (alt. si.F)
'c' : si.T, ... | 2.59375 | 3 |
src/core/tasking/llnms-register-task.py | marvins/LLNMS | 0 | 12774755 | <reponame>marvins/LLNMS<gh_stars>0
#!/usr/bin/env python
#
# File: llnms-register-task.py
# Author: <NAME>
# Date: 6/21/2015
#
# Purpose: Register a Task with LLNMS
#
__author__ = '<NAME>'
# Python Libraries
import os, sys, argparse
# LLNMS Libraries
if os.environ['LLNMS_HOME'] is not None:
... | 2.234375 | 2 |
model.py | karth295/hacks-on-hacks | 0 | 12774756 | <reponame>karth295/hacks-on-hacks
import csv
def delta_growth_by_zipcode(file):
growth = {}
with open(file, 'rb') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
growth[float(line[0])] = float(line[2]) - float(line[1]) # delta in growth by zip code
return growth
def main():
growth... | 3.40625 | 3 |
python/treelas/idx.py | EQt/treelas | 3 | 12774757 | <gh_stars>1-10
from graphidx.idx import ( # noqa
BiAdjacent,
ChildrenIndex,
PartitionIndex,
cluster,
)
| 0.964844 | 1 |
checks/load_favicons_test.py | thegreenwebfoundation/green-spider | 19 | 12774758 | from pprint import pprint
import httpretty
from httpretty import httprettified
import unittest
from checks import load_favicons
from checks.config import Config
@httprettified
class TestFavicons(unittest.TestCase):
def test_favicons(self):
# This site has a favicon
url1 = 'http://example1.com/fa... | 2.765625 | 3 |
hkl/tests/test_diffract.py | bluesky/hklpy | 1 | 12774759 | import gi
import numpy.testing
import pint
import pyRestTable
import pytest
gi.require_version("Hkl", "5.0")
# NOTE: MUST call gi.require_version() BEFORE import hkl
from hkl.calc import A_KEV
from hkl.diffract import Constraint
from hkl import SimulatedE4CV
class Fourc(SimulatedE4CV):
...
@pytest.fixture(scop... | 1.976563 | 2 |
probability_basic/discrete_distributions/discrete_distributions.py | OnlyBelter/MachineLearning_examples | 14 | 12774760 | <filename>probability_basic/discrete_distributions/discrete_distributions.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 16 18:47:10 2017
@author: xin
"""
# an example
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def example1():
# 分布的参数初始化
myDF = stats.norm(5... | 3.359375 | 3 |
Apr_13.py | keiraaaaa/Leetcode | 0 | 12774761 | <gh_stars>0
'''
################
# 55. Jump Game
################
class Solution:
def canJump(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if not nums or (nums[0]==0 and len(nums)>1):
return False
if len(nums)==1:
return True
... | 3.671875 | 4 |
dictionary/1_retrieve.py | fossabot/hotpot | 1 | 12774762 | import zipfile
from utils import download_from_url
# =================================
# Script purpose:
# Download and unzip all raw files
# =================================
# Word frequency calculations from Beijing Language and Culture University
download_from_url(
"http://bcc.blcu.edu.cn/downloads/resources... | 2.609375 | 3 |
capreolus/benchmark/__init__.py | nimasadri11/capreolus | 77 | 12774763 | import os
import json
from copy import deepcopy
from collections import defaultdict
import ir_datasets
from capreolus import ModuleBase
from capreolus.utils.caching import cached_file, TargetFileExists
from capreolus.utils.trec import write_qrels, load_qrels, load_trec_topics
from capreolus.utils.loginit import get_l... | 2.21875 | 2 |
src/logexception/exceptionhandler.py | nabeelraja/mip-python-training | 0 | 12774764 | <filename>src/logexception/exceptionhandler.py
'''
Create exceptions based on your inputs. Please follow the tasks below.
- Capture and handle system exceptions
- Create custom user-based exceptions
'''
class CustomInputError(Exception):
def __init__(self, *args, **kwargs):
print("Going through my own... | 3.578125 | 4 |
Module/CBAM.py | YuHe0108/cvmodule | 0 | 12774765 | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
"""
论文中指出了,先使用CA,后使用SA
定义了:
channel attention output.shape: [b, 1, 1, filters]
spatial attention output.shape: [b, h, w, 1]
"""
def regularized_padded_conv(*args, **kwargs):
""" 定义... | 2.828125 | 3 |
src/selfie_intersection/src/intersection_mock_client.py | KNR-Selfie/selfie_carolocup2020 | 10 | 12774766 | #! /usr/bin/env python
from __future__ import print_function
import rospy
import actionlib
import time
from std_msgs.msg import Float32
from selfie_msgs.msg import PolygonArray
import selfie_msgs.msg
def intersection_client():
client = actionlib.SimpleActionClient('intersection', selfie_msgs.msg.intersectionAct... | 2.25 | 2 |
notebooks/icos_jupyter_notebooks/tools/visualization/bokeh_help_funcs/__init__.py | ICOS-Carbon-Portal/jupyter | 6 | 12774767 | """
This folder contains help-functions to Bokeh visualizations
in Python.
There are functions that align 2nd-ary y-axis to primary
y-axis as well as functions that align 3 y-axes.
"""
__credits__ = "ICOS Carbon Portal"
__license__ = "GPL-3.0"
__version__ = "0.1.0"
__maintainer__ = "I... | 1.617188 | 2 |
factory/tools/manual_glidein_submit.py | bbockelm/glideinWMS | 0 | 12774768 | #!/usr/bin/env python
import os
import sys
import ConfigParser
STARTUP_DIR = sys.path[0]
sys.path.append(os.path.join(STARTUP_DIR,".."))
sys.path.append(os.path.join(STARTUP_DIR,"../../lib"))
from glideinwms.factory.glideFactoryCredentials import SubmitCredentials
from glideinwms.factory.glideFactoryLib import submi... | 2.296875 | 2 |
ctc_decoder/best_path.py | a-sneddon/CTCDecoder | 0 | 12774769 | from itertools import groupby
import numpy as np
def best_path(mat: np.ndarray, labels: str) -> str:
"""Best path (greedy) decoder.
Take best-scoring character per time-step, then remove repeated characters and CTC blank characters.
See dissertation of Graves, p63.
Args:
mat: Output of neur... | 3.015625 | 3 |
marketplace/vm-solution/cluster.py | isabella232/datashare-toolkit | 0 | 12774770 | # Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 1.601563 | 2 |
matrix.py | sumnerevans/math-utils | 0 | 12774771 | <reponame>sumnerevans/math-utils<filename>matrix.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
from fractions import Fraction
class Matrix:
def __init__(self, data=None):
self.data = data
def _... | 4.0625 | 4 |
tests/test_data/test_datasets/__init__.py | rlleshi/mmaction2 | 1,870 | 12774772 | <filename>tests/test_data/test_datasets/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from .base import BaseTestDataset
__all__ = ['BaseTestDataset']
| 1.007813 | 1 |
Curso de Python USP Part1/Exercicios/ProgramaCompleto_Jogo_NIM.py | JorgeTranin/Cursos_Coursera | 0 | 12774773 | def computador_escolhe_jogada(n, m):
pc_remove = 1
while pc_remove != m:
if (n - pc_remove) % (m+1) == 0:
return pc_remove
else:
pc_remove += 1
return pc_remove
def usuario_escolhe_jogada(n, m):
while True:
usuario_removeu = int(input('Quantas peças você... | 3.875 | 4 |
setup.py | ukitinu/event-reminder | 1 | 12774774 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as f:
readme = f.read()
setup(
name="event-reminder",
version="1.0.0",
description="Show messages at a specific date with crontab-like scheduling expressions.",
author="ukitinu",
... | 1.445313 | 1 |
bin/email_sender.py | vconstellation/steam-forum-scraper | 0 | 12774775 | import smtplib
import json
import keyring
from datetime import date
from email.message import EmailMessage
def send_emails(posts):
# get login and service from cfg
# then get pass from keyring
with open('config.json', 'r') as f:
config = json.load(f)
service = config["MAIL"]["service"]
lo... | 2.84375 | 3 |
stream_alert/rule_processor/main.py | serhatcan/streamalert | 1 | 12774776 | <reponame>serhatcan/streamalert
'''
Copyright 2017-present, Airbnb 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
Unless required by applicable ... | 1.679688 | 2 |
removing_nonconserved.py | tipputa/Reversals_identification | 0 | 12774777 | <gh_stars>0
#!/usr/bin/env python
"ordering as well as rotation of the genomes is done for almost conserved genes"
"missing genes are stored in sorted order"
from xlrd import open_workbook
import xlsxwriter
wb = open_workbook("FILE.xlsx")
workbookfinal = xlsxwriter.Workbook("removed_not_conserved"+'.x... | 3.265625 | 3 |
fluent.pygments/fluent/pygments/cli.py | shlomyb-di/python-fluent | 155 | 12774778 | import argparse
import sys
from pygments import highlight
from pygments.formatters import Terminal256Formatter
from fluent.pygments.lexer import FluentLexer
def main():
parser = argparse.ArgumentParser()
parser.add_argument('path')
args = parser.parse_args()
with open(args.path) as fh:
code =... | 2.390625 | 2 |
steam/ext/dota2/protobufs/dota_match_metadata.py | Gobot1234/steam-ext-dota2 | 0 | 12774779 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: dota_match_metadata.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import List
import betterproto
from .base_gcmessages import CsoEconItem
from .dota_gcmessages_common import CMsgDotaMatch, CMsgMatchTips
from .dot... | 1.398438 | 1 |
arrow/users/migrations/0003_application_hierarchy.py | AkhilGKrishnan/arrow | 0 | 12774780 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-11-05 16:19
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_2017110... | 1.625 | 2 |
tests/adapters/shell/mock_terminal_commands.py | FrancoisLopez/netman | 38 | 12774781 | # Copyright 2015 Internap.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 2.390625 | 2 |
source/appModules/searchui.py | siddhartha-iitd/NVDA-Enhancements | 0 | 12774782 | <reponame>siddhartha-iitd/NVDA-Enhancements
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2015 NV Access Limited
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import appModuleHandler
import controlTypes
import api
import speech
from NVDAObjects.UI... | 1.84375 | 2 |
biobb_wf_md_setup_mutations/python/workflow.py | bioexcel/biobb_workflows | 2 | 12774783 | #!/usr/bin/env python3
import time
import argparse
from biobb_common.configuration import settings
from biobb_common.tools import file_utils as fu
from biobb_chemistry.ambertools.reduce_remove_hydrogens import reduce_remove_hydrogens
from biobb_structure_utils.utils.extract_molecule import extract_molecule
from biobb_... | 1.617188 | 2 |
src/ocd/utilities.py | ofirr/OpenCommunity | 0 | 12774784 | <filename>src/ocd/utilities.py
import uuid
def create_uuid():
return uuid.uuid4().hex
| 1.929688 | 2 |
ads/adsconstants.py | rako233/TC2ADSProtocol | 0 | 12774785 | <gh_stars>0
"""Collection of all documented ADS constants. Only a small subset of these
are used by code in this library.
Source: http://infosys.beckhoff.com/english.php?content=../content/1033/tcplclibsystem/html/tcplclibsys_constants.htm&id= # nopep8
"""
"""Port numbers"""
# Port number of the standard lo... | 1.65625 | 2 |
mysite/classroom/models.py | anishmo99/Classrooom-Django-Web-App | 1 | 12774786 | from django.utils import timezone
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class User(AbstractBaseUser):
is_student = models.BooleanField(default=False)
is_teacher = models.BooleanField(default=False)
# class Teacher(models.Model):
# teacher_name = mo... | 2.53125 | 3 |
images/models.py | cebanauskes/ida_images | 0 | 12774787 | <reponame>cebanauskes/ida_images
import os
from urllib.request import urlretrieve
from django.db import models
from django.core.files import File
class Image(models.Model):
"""Модель Изображения
pub_date - поле с датой публикации изображения
url - поле с ссылкой на изображение, если оно загружено со ст... | 2.328125 | 2 |
tests/conftest.py | aspose-email-cloud/aspose-email-cloud-python | 1 | 12774788 | <reponame>aspose-email-cloud/aspose-email-cloud-python
import json
import os
import sys
import uuid
sys.path.append(os.path.join(os.path.dirname(__file__), "../sdk"))
from AsposeEmailCloudSdk import api, models
import pytest
class EmailApiData:
def __init__(self, email_cloud: api.EmailCloud, folder, storage):
... | 2.15625 | 2 |
src/wai/annotations/core/plugin/_get_all_plugins_by_type.py | waikato-ufdl/wai-annotations-core | 0 | 12774789 | <reponame>waikato-ufdl/wai-annotations-core<gh_stars>0
from ..specifier.util import specifier_type
from ._cache import *
from ._get_all_plugins import get_all_plugins
def get_all_plugins_by_type() -> Dict[Type[StageSpecifier], Dict[str, Type[StageSpecifier]]]:
"""
Gets a dictionary from plugin base-type to th... | 1.984375 | 2 |
case_cleaner.py | fcoclavero/text-preprocess | 2 | 12774790 | __author__ = ["<NAME>"]
__description__ = "Text cleaner functions that deal with casing."
__email__ = ["<EMAIL>"]
__status__ = "Prototype"
import re
def clean_cases(text: str) -> str:
"""Makes text all lowercase.
Arguments:
text:
The text to be converted to all lowercase.
Returns:
... | 3.296875 | 3 |
dados_cnpj_lista_url.py | rictom/cnpj-mysql | 3 | 12774791 | <filename>dados_cnpj_lista_url.py
# -*- coding: utf-8 -*-
"""
Spyder Editor
lista relação de arquivos na página de dados públicos da receita federal
"""
url = 'https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/consultas/dados-publicos-cnpj'
url = 'http://172.16.58.3/CNPJ/'
from... | 2.96875 | 3 |
pycozmo/tests/test_image_encoder.py | gimait/pycozmo | 123 | 12774792 |
import unittest
from pycozmo.image_encoder import ImageEncoder, str_to_image, ImageDecoder, image_to_str
from pycozmo.util import hex_dump, hex_load
from pycozmo.tests.image_encoder_fixtures import FIXTURES
class TestImageEncoder(unittest.TestCase):
@staticmethod
def _encode(sim: str) -> str:
im = ... | 2.53125 | 3 |
traditional_methods.py | hpi-sam/GNN-TiborMaxTiago | 11 | 12774793 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# use all cores
#import os
#os.system("taskset -p 0xff %d" % os.getpid())
pd.options.mode.chained_assignment = None # deactivating slicing warns
def load_seattle_speed_matrix():
""" Loads the whole Seattle `speed_matrix_2015` into memory.
... | 3.421875 | 3 |
app/security.py | ruter/otakucal | 0 | 12774794 | from itsdangerous import URLSafeTimedSerializer
from . import app
ts = URLSafeTimedSerializer(app.config['SECRET_KEY']) | 1.375 | 1 |
qbert/goexplore_py/randselectors.py | StrangeTcy/Q-BERT | 57 | 12774795 | from .import_ai import *
from tqdm import tqdm
# from montezuma_env import *
@dataclass()
class Weight:
weight: float = 1.0
power: float = 1.0
def __repr__(self):
return f'w={self.weight:.2f}=p={self.power:.2f}'
@dataclass()
class DirWeights:
horiz: float = 2.0
vert: float = 0.3
sco... | 2.328125 | 2 |
timeline/urls.py | mikechumba/insta | 0 | 12774796 | from django.conf import settings
from django.conf.urls.static import static
from django.urls import path,include
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
from .forms import LoginForm
urlpatterns = [
path('', views.index, name="home"),
path('register... | 1.898438 | 2 |
old/gridsearchXGboostR.py | giorgiopiatti/hgboost | 21 | 12774797 | <filename>old/gridsearchXGboostR.py<gh_stars>10-100
# The process of performing random search with cross validation is:
# 1. Set up a grid of hyperparameters to evaluate
# 2. Randomly sample a combination of hyperparameters
# 3. Create a model with the selected combination
# 4. Evaluate the model using cross validation... | 3.453125 | 3 |
tridet/utils/train.py | flipson/dd3d | 227 | 12774798 | <gh_stars>100-1000
# Copyright 2021 Toyota Research Institute. All rights reserved.
import logging
import os
from tabulate import tabulate
from termcolor import colored
from detectron2.utils.events import get_event_storage
LOG = logging.getLogger(__name__)
def get_inference_output_dir(dataset_name, is_last=False,... | 2.046875 | 2 |
P1/task_2.2/task_2pt2.py | VitusP/IoT-Analytics | 0 | 12774799 | <gh_stars>0
import pandas as pd
import random
import math
import collections
## Global Data
mc = 0
rtcl = 3
nonRTCL = 5
n_rt = 0
n_nonrt = 0
scl = 4
s = 2 #server status
pre_empted_service_time = 0
iat_rt = 10
iat_nonrt = 5
serviceTime_rt = 2
serviceTime_nonrt = 4
iat_rt_mu = 10
iat_nonrt_mu = 5
serviceTime_rt_mu = 2... | 2.796875 | 3 |
models/object.py | matheuspb/igs | 1 | 12774800 | """ This module contains a class that describes an object in the world. """
import numpy as np
class Object:
"""
Object is a simple wireframe composed of multiple points connected by
lines that can be drawn in the viewport.
"""
TOTAL_OBJECTS = -1
def __init__(self, points=None, name=... | 3.4375 | 3 |
sited_py/lib/org_noear_siteder_dao_engine_sdVewModel_BookSdViewModel.py | wistn/sited_py | 0 | 12774801 | <reponame>wistn/sited_py
# -*- coding: UTF-8 -*-
"""
Author:wistn
since:2020-09-23
LastEditors:Do not edit
LastEditTime:2021-03-04
Description:
"""
from .org_noear_siteder_dao_engine_DdSource import DdSource
from .mytool import TextUtils
from .android_util_Log import Log
from .org_noear_siteder_viewModels_ViewModelBase... | 2.0625 | 2 |
Python/tangshi.py | jmworsley/TangShi | 1 | 12774802 | <filename>Python/tangshi.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import re
import codecs
ping = re.compile(u'.平')
shang = re.compile(u'上聲')
ru = re.compile(u'入')
qu = re.compile(u'去')
mydict = { }
# f = open("../Data/TangRhymesMap.csv")
f = codecs.open("../Data/TangRhymesMap.csv", "r", "utf-8")
for... | 3.3125 | 3 |
app/views/handlers/auth_handler.py | pwgraham91/Cloud-Contact | 3 | 12774803 | <filename>app/views/handlers/auth_handler.py
import flask
from requests_oauthlib import OAuth2Session
from config import Auth
def get_google_auth(state=None, token=None):
if token:
return OAuth2Session(Auth.CLIENT_ID, token=token)
if state:
return OAuth2Session(
Auth.CLIENT_ID,
... | 2.625 | 3 |
linehaul/_server.py | dstufft/linehaul | 0 | 12774804 | #!/usr/bin/env python3.5
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#... | 2.59375 | 3 |
tibber_aws/__init__.py | tibber/tibber-pyAws | 0 | 12774805 | # flake8: noqa
from .aws_base import get_aiosession
from .aws_lambda import invoke as lambda_invoke
from .aws_queue import Queue
from .aws_metadata import get_instance_id
from .s3 import STATE_NOT_EXISTING, STATE_OK, STATE_PRECONDITION_FAILED, S3Bucket
from .secret_manager import get_secret, get_secret_parser
from .sns... | 1.234375 | 1 |
Code/Visualizations/visualizer.py | jaspertaylor-projects/QuantumLatticeGasAlgorithm | 1 | 12774806 | <reponame>jaspertaylor-projects/QuantumLatticeGasAlgorithm
"Importing visualization files..."
import numpy as np
import os
import cv2
os.environ['CUDA_DEVICE'] = str(0) #Set CUDA device, starting at 0
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from importlib import import_module
class vi... | 2.46875 | 2 |
model.py | utting/whiley2boogie | 1 | 12774807 | # -*- coding: utf-8 -*-
"""
Python module for recording Boogie models and printing them in Whiley syntax.
Use boogie /printModel:0 wval.bpl prog.bpl
@author: <NAME>
"""
import sys
class Model:
"""Stores the details of one Boogie counter-example.
Provides facilities for simplifying the model to improve readab... | 3.28125 | 3 |
pycrostates/utils/utils.py | mscheltienne/pycrostates | 1 | 12774808 | """Utils functions."""
from copy import deepcopy
import mne
import numpy as np
from ._logs import logger
# TODO: Add test for this. Also compare speed with latest version of numpy.
# Also compared speed with a numba implementation.
def _corr_vectors(A, B, axis=0):
# based on:
# https://github.com/wmvanvlie... | 3.234375 | 3 |
web/web/constants.py | pbvarga1/docker_opportunity | 1 | 12774809 | <reponame>pbvarga1/docker_opportunity
import os
DOCKER_HOST = os.environ.get('DOCKER_IP', '192.168.99.100')
DSN = f'http://9929242db8104494b679b60c94b0f96d@{DOCKER_HOST}:9000/2'
| 1.710938 | 2 |
backend/equipment/models.py | Vini1979/Engenharia_Software_IF977 | 0 | 12774810 | from django.db import models
from django.utils import timezone
STATE_CHOICES = [
("Good", "Good"),
("Needs repair", "Needs repair"),
("In repair", "In repair"),
]
class Equipment(models.Model):
name = models.CharField(max_length=200)
def __str__(self):
return self.name
class Item(model... | 2.328125 | 2 |
BaekJoon Online Judge/step/3-For-Loop/[8393] sum.py | TyeolRik/CodingProblems | 0 | 12774811 | <reponame>TyeolRik/CodingProblems
# https://www.acmicpc.net/problem/8393
a = int(input())
result = 0
for i in range(a + 1):
result = result + i
print(result) | 3.59375 | 4 |
gssapi/tests/test_raw.py | judilsteve/python-gssapi | 84 | 12774812 | <filename>gssapi/tests/test_raw.py<gh_stars>10-100
import copy
import ctypes
import ctypes.util
import os
import socket
import sys
import unittest
import gssapi.raw as gb
import gssapi.raw.misc as gbmisc
import k5test.unit as ktu
import k5test as kt
from collections.abc import Set
TARGET_SERVICE_NAME = b'host'
FQDN... | 1.898438 | 2 |
Code/arrayTest.py | Wolfcoder13/Drooper | 0 | 12774813 | import numpy as numpy
a = numpy.arange(150)
# a[0::2] *= numpy.sqrt(2)/2.0 * (numpy.cos(2) - numpy.sin(2))
a[0::2] *= 2
print(a) | 2.90625 | 3 |
chapter6/shodan/shodan_api_rest.py | gabrielmahia/ushuhudAI | 0 | 12774814 | import shodan
import requests
SHODAN_API_KEY = ""
api = shodan.Shodan(SHODAN_API_KEY)
domain = 'www.python.org'
dnsResolve = 'https://api.shodan.io/dns/resolve?hostnames=' + domain + '&key=' + SHODAN_API_KEY
try:
resolved = requests.get(dnsResolve)
hostIP = resolved.json()[domain]
host = api.host(... | 2.828125 | 3 |
game.py | Catsuko/Westward | 3 | 12774815 | from actors.actions.hit_and_run_action import HitAndRunAction
from actors.actions.input_driven_action import InputDrivenAction
from actors.actions.shoot_at_action import ShootAtAction
from actors.actor_target import ActorTarget
from actors.components.components import Components
from actors.components.health import Hea... | 2.15625 | 2 |
users/migrations/0005_auto_20200811_0450.py | Emmanuel-9/Instagram | 0 | 12774816 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-08-11 01:50
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
m... | 1.65625 | 2 |
activeusers/urls.py | Yuego/django-activeusers | 0 | 12774817 | <filename>activeusers/urls.py
from django.conf.urls import url
from activeusers import views
app_name = 'activeusers'
urlpatterns = [
url(r'^refresh/$', views.update_active_users, name='activeusers-refresh-active-users', ),
url(r'^refresh/json/$', views.get_active_users, name='activeusers-get-active-users', )... | 1.757813 | 2 |
scem/gen.py | noukoudashisoup/score-EM | 3 | 12774818 | <gh_stars>1-10
"""Module for generative models"""
import torch
import torch.nn as nn
import torch.distributions as dists
from scem import stein, net
from scem import util
from abc import ABCMeta, abstractmethod
from torch.nn.parameter import Parameter
class ConditionalSampler(metaclass=ABCMeta):
"""Abstract clas... | 2.640625 | 3 |
complexnn.py | iseeklin/Electromagnetic-Signal-Recognition-Using-Deep-Learning | 0 | 12774819 | <filename>complexnn.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class ComplexConv(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True):
super(ComplexConv, self).__init__()
self.device... | 2.59375 | 3 |
Chat.py | TheTimgor/sadbot-3 | 0 | 12774820 | <gh_stars>0
import json
import os
import pickle
from collections import Counter
from heapq import nlargest
from random import choice, sample
import math
import nltk
import numpy
from nltk import NaiveBayesClassifier
from nltk import word_tokenize
from nltk.parse import stanford
from nltk.tag import StanfordNERTagger
#... | 2.359375 | 2 |
recipes/Python/577611_edit_dictionary_values_possibly_restrained/recipe-577611.py | tdiprima/code | 2,023 | 12774821 | <filename>recipes/Python/577611_edit_dictionary_values_possibly_restrained/recipe-577611.py
"""
DICTIONNARY INTERFACE FOR EDITING VALUES
creates labels/edits/menubutton widgets in a TkFrame to edit dictionary values
use: apply(frame,dict,position)
"""
import Tkinter as tk
def cbMenu(controlV,value,btn= None):
con... | 2.765625 | 3 |
src/interface.py | luizeduardomr/ScrapingNews | 0 | 12774822 | import os
import PySimpleGUI as sg
sg.change_look_and_feel('DarkAmber') # colour
# layout of window
layout = [
[sg.Frame(layout=[
[sg.Radio('1. Estadao', 1, default=False, key='estadao'),
sg.Radio('2. Folha', 1,
default=False, key='folha'),
sg.Radio('3. Uol Notícias... | 3.21875 | 3 |
features/steps/managers/kobiton_manager.py | lordkyzr/launchkey-python | 9 | 12774823 | <filename>features/steps/managers/kobiton_manager.py
import requests
from time import sleep
class Version:
def __init__(self, id, state=None, version=None, native_properties=None, latest=None):
"""
Kobiton App Version.
Note that no values are required based on the spec so any value can
... | 2.359375 | 2 |
main.py | LucasRibeiroRJBR/Modelo_Conexao_Python_Oracle | 1 | 12774824 | <filename>main.py<gh_stars>1-10
import cx_Oracle, os
try:
connection = cx_Oracle.connect(
user='PY',
password='<PASSWORD>',
dsn='localhost:1521/XE',
encoding='UTF-8'
)
print(connection.version)
while True:
id = input('\nDigite o ID do aluno (0 para sair) -> ')
... | 2.796875 | 3 |
src/djanban/apps/dev_environment/migrations/0003_auto_20160925_1811.py | diegojromerolopez/djanban | 33 | 12774825 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-25 16:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('boards', '0028_auto_20160925_1809'),
('members', '0008_auto_20160923_2056'),
('dev_env... | 1.585938 | 2 |
dashboard-backend/dashboard/mock_stats.py | 2021hy-team6/dashboard | 0 | 12774826 | <filename>dashboard-backend/dashboard/mock_stats.py<gh_stars>0
import random
import string
import datetime
class MockStats:
def __init__(self, psql):
self.psql = psql
def get_random_text(self, length):
name = [random.choice(string.ascii_letters)
for _ in range(random.ch... | 2.5625 | 3 |
tests/test_zuul_lint.py | pycontribs/zuul-lint | 2 | 12774827 | import pytest
import sh
def test_invalid():
try:
sh.python(["-m", "zuul_lint", "tests/data/zuul-config-invalid.yaml"])
except sh.ErrorReturnCode_1:
return
except sh.ErrorReturnCode as e:
pytest.fail(e)
pytest.fail("Expected to fail")
def test_valid():
try:
sh.pyth... | 2.3125 | 2 |
vega/search_space/networks/pytorch/customs/adelaide_nn/mobilenetv2_backbone.py | qixiuai/vega | 12 | 12774828 | <reponame>qixiuai/vega
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... | 2.15625 | 2 |
src/Python27Packages/PCC/PCC/params.py | lefevre-fraser/openmeta-mms | 0 | 12774829 | <gh_stars>0
from collections import namedtuple #here so we can use a "structure"-like entity
from numpy import *
import gaussquad
#*****************COMPUTATION OF QUADRATURE NODES AND WEIGHTS**************
def params(method=None, m=None, inpt=None, stvars=None):
node = zeros((inpt,max(m)))
weight = z... | 2.546875 | 3 |
keanu-python/tests/test_cast.py | rs992214/keanu | 153 | 12774830 | <gh_stars>100-1000
from keanu.vertex.vertex_casting import (cast_tensor_arg_to_double, cast_tensor_arg_to_integer,
cast_tensor_arg_to_boolean)
from keanu.vertex import cast_to_boolean_vertex, cast_to_integer_vertex, cast_to_double_vertex
from keanu.vartypes import (primitive_typ... | 2.171875 | 2 |
chap8/data/gen_mxnet_imglist.py | wang420349864/dlcv_for_beginners | 1,424 | 12774831 | import os
import sys
input_path = sys.argv[1].rstrip(os.sep)
output_path = sys.argv[2]
filenames = os.listdir(input_path)
with open(output_path, 'w') as f:
for i, filename in enumerate(filenames):
filepath = os.sep.join([input_path, filename])
label = filename[:filename.rfind('.')].split('_')[1]
... | 2.84375 | 3 |
forward/schechter.py | rprollins/forward | 0 | 12774832 | <filename>forward/schechter.py
import numpy as np
from collections import namedtuple
SchechterParameters = namedtuple('SchechterParameters', ['a_phi', 'b_phi', 'a_m', 'b_m', 'alpha'])
def dv_domega_dz(z, cosmology):
d_h = cosmology.hubble_distance
d_m = cosmology.comoving_transverse_distance(z)
e_fac = np... | 2.453125 | 2 |
StinoStarter.py | huangxuantao/MyStino | 2 | 12774833 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# Documents
#
"""
Documents
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import re
import sublime
import sublime_plugin
st_version = int(sublime.versi... | 2.03125 | 2 |
soybean/utils.py | lcgong/soybean | 2 | 12774834 | <filename>soybean/utils.py
import re
import os
import socket
from sys import modules
from sqlblock.utils.json import json_dumps, json_loads
from rocketmq.client import Message
from .exceptions import InvalidGroupId, InvalidTopicName
VALID_NAME_PATTERN = re.compile("^[%|a-zA-Z0-9_-]+$")
VALID_NAME_STR = (
"allowi... | 2.640625 | 3 |
tests/properties/test_hexagonal.py | kei0822kei/twinpy | 0 | 12774835 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is pytest for twinpy.properties.hexagonal.
"""
from copy import deepcopy
import numpy as np
from twinpy.properties import hexagonal
a = 2.93
c = 4.65
def test_check_hexagonal_lattice(ti_cell_wyckoff_c):
"""
Check check_hexagonal_lattice.
"""
he... | 2.671875 | 3 |
geetools/cloud_mask.py | bworstell/gee_tools | 4 | 12774836 | <reponame>bworstell/gee_tools<filename>geetools/cloud_mask.py
# !/usr/bin/env python
# coding=utf-8
from __future__ import print_function
from . import tools
from . import decision_tree
import ee
from . import __version__
from .bitreader import BitReader
import ee.data
if not ee.data._initialized: ee.Initialize()
# ... | 1.820313 | 2 |
demos/python/sdk_wireless_camera_control/docs/conf.py | hoehnp/OpenGoPro | 0 | 12774837 | # conf.py/Open GoPro, Version 1.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Tue May 18 22:08:50 UTC 2021
project = "Open GoPro Python SDK"
copyright = "2020, GoPro Inc."
author = "<NAME>"
version = "0.5.8"
release = "0.5.8"
templates_path = ["_templates"]
sourc... | 1.070313 | 1 |
HackerRank/Python/Maximum_Element.py | GoTo-Coders/Competitive-Programming | 4 | 12774838 | <reponame>GoTo-Coders/Competitive-Programming
# Link --> https://www.hackerrank.com/challenges/maximum-element/problem
# Code:
def getMax(operations):
maximum = 0
temp = []
answer = []
for i in operations:
if i != '2' and i != '3':
numbers = i.split()
number = int(n... | 3.984375 | 4 |
plot_compo.py | AHinterding/etf-loader | 0 | 12774839 | <reponame>AHinterding/etf-loader<filename>plot_compo.py
import datetime as dt
from etf_mapper import CompoMapper
if __name__ == '__main__':
mapper = CompoMapper()
plot_date = dt.date.today() # Download data first before running!
mapper.plot(plot_date, 'WOOD')
| 2.125 | 2 |
models/base_trainer.py | P0lyFish/noise2-series | 4 | 12774840 | <gh_stars>1-10
import os
import logging
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
# for debugging purpose
# import cv2
# import numpy as np
# from utils import util
logger = logging.getLogger('base')
class BaseTrainer():
def __i... | 2.1875 | 2 |
tests/get_fix_rate_for_amount_test.py | k0t3n/changelly_api | 7 | 12774841 | <filename>tests/get_fix_rate_for_amount_test.py
import pytest
import requests_mock
from changelly_api.conf import API_ROOT_URL
from changelly_api.exceptions import AmountGreaterThanMaximum, AmountLessThanMinimum
@requests_mock.Mocker(kw='requests_mock')
def test(api, get_fix_rate_for_amount_data, **kwargs):
r_mo... | 2.296875 | 2 |
lab10-2.py | hanna56/Algorithm-lecture | 2 | 12774842 | <filename>lab10-2.py
# 양방향 연결 리스트 노드 삽입 (insertBefore() 구현)
class Node:
def __init__(self, item):
self.data = item
self.prev = None
self.next = None
class DoublyLinkedList:
def __init__(self):
self.nodeCount = 0
self.head = Node(None)
self.tail = Node(None)
... | 3.9375 | 4 |
panda/dataframe/pearson_r_dataframe.py | vaibhavg12/python | 0 | 12774843 | <reponame>vaibhavg12/python
import pandas as pd
path = "C:\\Users\\gv01\\Desktop\\googleSync\\LEarning\\Udacity\\Data Scientists Foundation\\python\\Resources\\"
filename = 'nyc-subway-weather.csv'
subway_df = pd.read_csv(path+filename)
def correlation(x, y):
'''
Fill in this function to compute the c... | 4.0625 | 4 |
Institute/database_handler.py | harshraj22/smallProjects | 2 | 12774844 | import json
INSTITUTION_TEMPLATE = '''
{
"Institution":{
"Students":{
},
"Teachers":{
},
"Quizzes":{
"DataStructures":{
},
"Algorithms":{
},
"MachineLearning":{
}
}
}
}
'''
class DatabaseHandler:
def __init__(self):
# add a try catch block if the... | 3.15625 | 3 |
scripts/proppr-helpers/pronghorn-wrapper.py | TeamCohen/ProPPR | 138 | 12774845 | <reponame>TeamCohen/ProPPR<gh_stars>100-1000
import sys
import os
import shutil
import getopt
import logging
import subprocess
import util as u
def makebackup(f):
bi=1
backup = "%s.%d" % (f,bi)
#backup_parent = "./"
#if f[0] == "/": backup_parent=""
#if f.rfind("/") > 0: backup_parent += f[:f.rfind... | 2.375 | 2 |
allies/management/commands/strip_allies.py | kevincornish/HeckGuide | 4 | 12774846 | <gh_stars>1-10
from django.core.management.base import BaseCommand, CommandError
from api import HeckfireApi, TokenException
from django.conf import settings
from allies.models import Ally
import logging
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Strip a users allies via supplied usern... | 2.265625 | 2 |
metric/rapid/observations.py | NCAR/metric | 0 | 12774847 | <filename>metric/rapid/observations.py
"""
Module containing code to work with Rapid observational data
"""
from netCDF4 import Dataset, num2date, date2num
import datetime
import numpy as np
import metric.utils
class RapidObs(object):
""" Template class to interface with observed ocean transports """
def __... | 2.640625 | 3 |
pc-containers-get-filtered-CSV-export.py | antoinesylvia/pc-toolbox | 2 | 12774848 | from __future__ import print_function
import os
from pprint import pprint
try:
input = raw_input
except NameError:
pass
import argparse
import pc_lib_api
import pc_lib_general
import json
import pandas
from datetime import datetime, date, time
from pathlib import Path
# --Execution Block-- #
# --Parse comman... | 2.609375 | 3 |
leetcode/algorithms/maximum-depth-of-binary-tree.py | yasserglez/programming-problems | 2 | 12774849 | <filename>leetcode/algorithms/maximum-depth-of-binary-tree.py<gh_stars>1-10
# https://leetcode.com/problems/maximum-depth-of-binary-tree/
from typing import Optional
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
clas... | 3.859375 | 4 |
sunpy/io/special/asdf/tags/tests/test_coordinate_frames.py | Cubostar/sunpy | 0 | 12774850 | <gh_stars>0
import os
import platform
from distutils.version import LooseVersion
import numpy as np
import pytest
import astropy.units as u
from astropy.coordinates import CartesianRepresentation
import sunpy.coordinates.frames as frames
from sunpy.tests.helpers import asdf_entry_points
asdf = pytest.importorskip('... | 2.09375 | 2 |