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 |
|---|---|---|---|---|---|---|
servo/drv/sflag.py | neverware-mirrors/hdctools | 0 | 12767651 | # Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Software flag module to store and report binary status."""
import hw_driver
# pylint: disable=invalid-name
# This follows servod drv naming conventi... | 2.65625 | 3 |
High School/9th Grade APCSP (Python)/Unit 4/04.01.01.py | SomewhereOutInSpace/Computer-Science-Class | 0 | 12767652 | <reponame>SomewhereOutInSpace/Computer-Science-Class
def bin_value(num):
return bin(num) [2:]
def remove0b(num):
return num [2:]
numberA = int(input(""))
numberB = int(input(""))
binaryA = bin_value(numberA)
binaryB = bin_value(numberB)
sum = bin(int(binaryA,2) + int(binaryB,2))
cleaned = remove0b(sum)
binary... | 3.609375 | 4 |
src/camguard/generic_mail_client.py | matt-hires/camguard | 3 | 12767653 | <reponame>matt-hires/camguard
import logging
import ssl
from os import path
from email.message import EmailMessage
from smtplib import SMTP as Client
from smtplib import SMTPConnectError
from typing import ClassVar, List
from camguard.bridge_impl import MailClientImpl
from camguard.mail_client_settings import Generic... | 2.1875 | 2 |
digital_land/datatype/address.py | digital-land/digital-land-python | 3 | 12767654 | <reponame>digital-land/digital-land-python<gh_stars>1-10
import re
from .datatype import DataType
comma_re = re.compile(r"(\s*,\s*){1,}")
hyphen_re = re.compile(r"(\s*-\s*){1,}")
class AddressDataType(DataType):
def normalise(self, value, issues=None):
# replace newlines and semi-colons with commas
... | 3.21875 | 3 |
main.py | JuXinglong/WFLOP_SUGGA_Python | 23 | 12767655 | import numpy as np
import pandas as pd
import WindFarmGenetic # wind farm layout optimization using genetic algorithms classes
from datetime import datetime
import os
from sklearn.svm import SVR
import pickle
# Wind farm settings and algorithm settings
# parameters for the genetic algorithm
elite_rate = 0.2... | 2.40625 | 2 |
04 - Classes-inheritance-oops/17-classes-inheritance-setters-shallow.py | python-demo-codes/basics | 2 | 12767656 | # HEAD
# Classes - Setters are shallow
# DESCRIPTION
# Describes how setting of inherited attributes and values function
# RESOURCES
#
# Creating Parent class
class Parent():
par_cent = "parent"
# Parent Init method
def __init__(self, val):
self.par_cent = val
print("Parent Instantiated ... | 4.46875 | 4 |
PyMRFLSSVM/Utils/ReadMat.py | yirencaifu/sample_python_trading_algo | 0 | 12767657 | <filename>PyMRFLSSVM/Utils/ReadMat.py
# -*- coding: utf-8 -*-
__author__ = 'spacegoing'
from scipy.io import loadmat
import numpy as np
def loadMatPairwise():
mat = loadmat('tmpData/learnPairwise.mat')
observed_unary = mat['instance']['unary'][0][0]
observed_unary = np.reshape(observed_unary, [128, 128, ... | 2.390625 | 2 |
main.py | nazariinyzhnyk/kaggle_fraud_detection | 0 | 12767658 | <reponame>nazariinyzhnyk/kaggle_fraud_detection
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
import h2o
from h2o.estimators.gbm import H2OGradientBoostingEstimator
pd.set_option('display.max_columns', None)
identity_train = pd.read_csv('data/train_identity.csv')
transactions_tr... | 2.40625 | 2 |
inventory/migrations/0002_auto_20200919_1121.py | Kgford/TCLI | 0 | 12767659 | <filename>inventory/migrations/0002_auto_20200919_1121.py
# Generated by Django 3.0.8 on 2020-09-19 15:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | 1.75 | 2 |
ChocoBallDetector/image_preprocess.py | tok41/choco-ball-statistics | 0 | 12767660 |
# -*- coding: utf-8 -*-
"""
目的
- アノテーション作業の前の一番最初の画像データの前処理
- 画像サイズを小さくする & 画像サイズを揃える
"""
import os
import glob
import numpy as np
from PIL import Image
import argparse
def main(args):
img_files = glob.glob(os.path.join(args.img_dir, args.img_filter))
print('image_dir : ', args.img_dir, ', filter : ', args... | 3.234375 | 3 |
python/25-solution/actions.py | gras/SensorWorkshop | 0 | 12767661 | <filename>python/25-solution/actions.py
# Making Sense of Sensors Workshop
# Educators Edition 2015
#
# 25-FindAndGrabTribble
# actions.py
'''
@author: Dead Robot Society
'''
from time import sleep
import movement as move
import sensor
##################################
# public routines
############################... | 3.546875 | 4 |
Deep Learning models training/BOW_ann.py | kwstas94/Disaster-Detection-Thesis | 0 | 12767662 | <reponame>kwstas94/Disaster-Detection-Thesis<gh_stars>0
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import nltk
import sklearn
from sklearn.preprocessing import Imputer
# Importing the Keras libraries and packages
import keras
from keras.models import Sequential
f... | 3.0625 | 3 |
app/routes.py | WebDevSand/python-mysql-panel | 1 | 12767663 | from flask import render_template, flash, redirect, url_for, request
import pymysql
import json
from app import *
from app.form import ServerInfo
from app.handler import *
@app.route('/', methods=['GET', 'POST'])
def login():
form = ServerInfo()
if form.validate_on_submit():
flash('Login requested for user {}, r... | 2.578125 | 3 |
practica1/software/FUENTES/algorithms/relief.py | antoniomdk/practicas_mh_ugr | 0 | 12767664 | <filename>practica1/software/FUENTES/algorithms/relief.py
import numpy as np
"""
In order to use the module pykdtree the system must have
OpenMP support. If there is any problem during the installation
process, we can use instead the KDTree implementation from
scipy.spatial module.
"""
try:
from pykdtree.kdtree imp... | 3.421875 | 3 |
Ops/Timecode.py | davidsoncolin/IMS | 0 | 12767665 | import math
from datetime import datetime, timedelta
from Ops import Op
def splitTc(tc):
hrs, mins, secs, frames = tc.split(":")
return hrs, mins, secs, frames
def TCFtoInt(tc, fps):
hrs, mins, secs, frames = splitTc(tc)
fps = math.ceil(float(fps))
if hrs != "" and mins != "" and secs != "" and frames != "" and... | 2.953125 | 3 |
tests/dockerfile/test_runner.py | tkishel/checkov | 1 | 12767666 | <reponame>tkishel/checkov<filename>tests/dockerfile/test_runner.py
import unittest
import os
from checkov.dockerfile.runner import Runner
from checkov.runner_filter import RunnerFilter
class TestRunnerValid(unittest.TestCase):
def test_runner_empty_dockerfile(self):
current_dir = os.path.dirname(os.pat... | 2.40625 | 2 |
model_training_and_evaluation/simple_scripts/plot_bootstrapped_f1s.py | skdreier/NIreland_NLP | 1 | 12767667 | import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import matplotlib
matplotlib.use('Agg')
# True indicates it's for 10-class multiway version
test_f1s_filename = '/Users/sofiaserrano/Downloads/paperResults/binaryTEST_withcontext_bootstrappedf1s.csv'
dev_f1s_filename = '/Users/sofiaserrano/Down... | 2.59375 | 3 |
drive-contents/boot_options/low_battery.py | TG-Techie/TG-Watch-Software | 1 | 12767668 | import time
import microcontroller
from hardware import drivers
if drivers.vbus_detect.value:
from . import low_battery_splash
while drivers._read_bat_percent() < 4:
time.sleep(5)
print(f"[time: {time.monotonic()}] battery too low, waiting to boot")
else:
print("battery charged to 4+ percent, restarti... | 3.046875 | 3 |
SRL/main.py | NarenKul/Biaffine-Parsing-Pytorch | 10 | 12767669 | <gh_stars>1-10
import torch
from torchtext import data
import numpy as np
from pbase import app, logger
from model import SRL
import os
print(os.getpid())
WORD = data.Field(batch_first=True, lower=True)
PLEMMA = data.Field(batch_first=True, lower=True)
PPOS = data.Field(batch_first=True)
DEP = data.Field(batch_first=... | 2.125 | 2 |
tensorflow_graphics/projects/cvxnet/train.py | Liang813/graphics | 2,759 | 12767670 | # Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 1.976563 | 2 |
proc.py | riceissa/fred-processing | 0 | 12767671 | <reponame>riceissa/fred-processing<filename>proc.py
#!/usr/bin/env python3
import requests
import os
import sys
from devec_sql_common import *
with open("apikey.txt", "r") as f:
API_KEY = next(f).strip()
def get_tags_from_file():
try:
with open("fred_tags", "r") as f:
return [line.strip... | 2.734375 | 3 |
tests/test_issues/test_issue_332.py | bpow/linkml | 0 | 12767672 | <filename>tests/test_issues/test_issue_332.py
import unittest
from linkml.generators.jsonldgen import JSONLDGenerator
from tests.test_issues.environment import env
class JSONContextTestCase(unittest.TestCase):
def test_context(self):
""" Test no context in the argument"""
self.assertIn('''"@conte... | 2.65625 | 3 |
firm-founding-wiki-search.py | merpaker/firm-founding-wiki-search | 0 | 12767673 | <reponame>merpaker/firm-founding-wiki-search<gh_stars>0
#################################################################
# Wikipedia Search for Historical Firm Founding Dates
# firm-founding-wiki-search.py
# Author: <NAME>, <EMAIL>
# Last edited: 17 November, 2017
# This script uses python's Wikipedia package sea... | 3.1875 | 3 |
tests/api_resources/test_subscription_item.py | bhch/async-stripe | 8 | 12767674 | from __future__ import absolute_import, division, print_function
import stripe
import pytest
pytestmark = pytest.mark.asyncio
TEST_RESOURCE_ID = "si_123"
class TestSubscriptionItem(object):
async def test_is_listable(self, request_mock):
resources = await stripe.SubscriptionItem.list(subscription="su... | 2.28125 | 2 |
MYgames_package/MYgames/__main__.py | MandiYang/MYgames | 1 | 12767675 | <filename>MYgames_package/MYgames/__main__.py
print('Hello')
print('Package name: MYgames')
| 1.1875 | 1 |
bptf/pretraining.py | antonyms/AntonymPipeline | 4 | 12767676 | <gh_stars>1-10
#!/usr/bin/python
from pretraining import mm
from pretraining.utils import *
rootPath = '../data/'
thPath = rootPath + 'combine/'
antPath = thPath + 'antonym.txt'
synPath = thPath + 'synonym.txt'
grePath = rootPath + 'test-data/gre_wordlist.txt'
commonPath = rootPath + 'test-data/test_wordlist.txt'
topP... | 2.484375 | 2 |
testcontainers/oracle.py | martykube/testcontainers-python | 0 | 12767677 | from testcontainers.core.generic import DbContainer
class OracleDbContainer(DbContainer):
def __init__(self, image="wnameless/oracle-xe-11g-r2:latest"):
super(OracleDbContainer, self).__init__(image=image)
self.container_port = 1521
self.with_exposed_ports(self.container_port)
def _co... | 2.109375 | 2 |
scripts/isqrt.py | Marlon-Lazo-Coronado/tiny-bignum-c | 331 | 12767678 | <reponame>Marlon-Lazo-Coronado/tiny-bignum-c
#isqrt.py
import math
def isqrt(n):
if n == 0: return 0
high = n
low = 0
calcMid = lambda: (high - low) / 2 + low + 1
mid = calcMid()
while high > low:
sq = mid**2
if sq > n:
high = mid - 1
else:
low = mid
mid = calcMid()
return low
if __name__ == "__... | 3.390625 | 3 |
tests/servers/server_302.py | jun-kai-xin/douban | 0 | 12767679 | <gh_stars>0
from http.server import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.log_message(' '.join(['{:s}:{:s}'.format(key, value) for (key, value) in self.headers.items()]))
self.send_response(302)
if self.path.find('sorry') > 0:
... | 2.921875 | 3 |
artifacts/models/seq2seq/seq2seq_inference.py | LittleQili/nnfusion | 0 | 12767680 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
import sys
import tensorflow as tf
from tensorflow.python.client import timeline
from tensorflow.python.... | 2 | 2 |
CodeWars/7 Kyu/Return String of First Characters.py | anubhab-code/Competitive-Programming | 0 | 12767681 | def make_string(s):
return "".join(word[0] for word in s.split())
| 3.140625 | 3 |
Algorithm/Implementation/Grading Students.py | rahamath2009/git-github.com-nishant-sethi-HackerRank | 76 | 12767682 |
import sys
def solve(grades):
# Complete this function
new_grades=[]
for i in grades:
if(i<38):
new_grade=i
else:
x=i%5
if(x<3):
new_grade=i
else:
new_grade=(i/5+1)*5
new_grades.append(n... | 3.6875 | 4 |
jianzhi_offer_31.py | JasonLeeSJTU/Algorithms_Python | 2 | 12767683 | <reponame>JasonLeeSJTU/Algorithms_Python<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
'''
@author: <NAME>
@license: (C) Copyright @ <NAME>
@contact: <EMAIL>
@file: jianzhi_offer_31.py
@time: 2019/4/23 16:09
@desc:
'''
class Solution:
def FindGreatestSumOfSubArray(self, array):
if not array... | 3.25 | 3 |
spirecomm/ai/agent.py | ErinMyLungs/spirecomm | 1 | 12767684 | import time
import random
import os
from spirecomm.spire.game import Game
from spirecomm.spire.character import Intent, PlayerClass
import spirecomm.spire.card
from spirecomm.spire.screen import RestOption
from spirecomm.communication.action import *
from spirecomm.ai.priorities import *
from spirecomm.ai.drafter impor... | 2.5 | 2 |
make_instance.py | github-nakasho/Pokemon_opt | 0 | 12767685 | #!/usr/bin/env python3
import numpy as np
import sys
def make_instance():
# normal、fire、water、electric、grass、ice、fighting, poison, ground,
# flying, psychic, bug, rock, ghost, dragon, dark, steel, fairy
type_matrix = np.array([[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 0.0, 1.0, 1.... | 2.5625 | 3 |
garble.py | dehall/data-owner-tools | 4 | 12767686 | #!/usr/bin/env python3
import argparse
import glob
import os
from pathlib import Path
import subprocess
import sys
from zipfile import ZipFile
def parse_arguments():
parser = argparse.ArgumentParser(
description="Tool for garbling PII in for PPRL purposes in the CODI project"
)
parser.add_argumen... | 3.03125 | 3 |
database/inserts.py | retropleinad/DnD-Calculator | 0 | 12767687 | <filename>database/inserts.py<gh_stars>0
from . import util
path = util.PATH
"""
This file contains methods to insert data into different tables
"""
# Insert into the region table
def insert_region(name, description):
args = (name, description)
query = """
INSERT INTO region(name, d... | 2.859375 | 3 |
client/python/GravityWebsocketApi.py | philoxnard/gravtest | 0 | 12767688 | <filename>client/python/GravityWebsocketApi.py
#!/usr/bin/python
"""
Client code that interacts with the web server over Websockets
Written by: <NAME>
Copyright 2019 Creative Collisions Technology, LLC
"""
import json
from websocket import create_connection
WEBSOCKET_URL_TEMPLATE = "ws://%s/ws1.ws"
class GravityW... | 3.03125 | 3 |
test/test_codeTime.py | adarshtri/SE_Fall20_Project-1 | 0 | 12767689 | <gh_stars>0
import sublime
import sys
from datetime import datetime as dt
from unittest import TestCase
from unittest.mock import Mock, patch
version = sublime.version()
codeTime = sys.modules["CodeTime.code.SublimePlugin.codeTime"]
class TestFunctions(TestCase):
@patch('time.time', return_value=100)
def t... | 2.703125 | 3 |
tutorials/W3D2_DynamicNetworks/solutions/W3D2_Tutorial2_Solution_0349af2c.py | liuxiaomiao123/NeuroMathAcademy | 2 | 12767690 | <filename>tutorials/W3D2_DynamicNetworks/solutions/W3D2_Tutorial2_Solution_0349af2c.py
def get_eig_Jacobian(pars, fp):
"""
Simulate the Wilson-Cowan equations
Args:
pars : Parameter dictionary
fp : fixed point (E, I), array
Returns:
evals : 2x1 vector of eigenvalues of the Jacobian matrix
... | 2.53125 | 3 |
forum/demo/06-demo.py | twiindan/api_lessons | 0 | 12767691 | <reponame>twiindan/api_lessons
__author__ = 'arobres'
import requests
### CUSTOM HEADERS ###
headers = {'my_header': 'important_header', 'content-type': 'application/json'}
response = requests.get('https://api-testing-conference.herokuapp.com/v1.0', headers=headers)
print(response.request.headers)
### COOKIES ###
u... | 2.6875 | 3 |
tests/profiles/test_constructors.py | pyroll-project/pyroll-core | 0 | 12767692 | import logging
import matplotlib.pyplot as plt
import numpy as np
import pytest
from shapely.affinity import rotate
from pyroll.core import SquareGroove, Profile
groove = SquareGroove(0, 3, tip_depth=20, tip_angle=91 / 180 * np.pi)
def test_from_groove():
Profile.from_groove(groove, width=45, height=50)
Pr... | 2.140625 | 2 |
tests.py | synapticarbors/fishers_exact_test | 47 | 12767693 | import numpy as np
import pytest
from fisher.cfisher import pvalue, pvalue_npy
# Computed by ``fisher.test`` in R 3.2.2 and printed with
# ``sprintf(".16f")``.
@pytest.mark.parametrize("table,expected", [
([[100, 2], [1000, 5]],
(0.1300759363430016, 0.9797904453147230, 0.1300759363430016)),
([[2, 100], ... | 1.710938 | 2 |
solutionPY/solban.py | RuwaidMuntajim/CodeForces | 0 | 12767694 | k, n, w = map(int, input().split())
x = 1
money = 0
while x <= w and money != -1:
money += k * x
x += 1
money_toborrow = money - n
if money_toborrow >= 0:
print(money_toborrow)
else:
print(0) | 2.875 | 3 |
Python_ex110_ex111/uteis.py | gabrieldepaiva/Exercicios-CursoEmVideo | 0 | 12767695 | <filename>Python_ex110_ex111/uteis.py
def fatorial (n):
r = 1
for num in range (n, 1, -1):
r *= num
return r
def dobro (n):
num = n * 2
return num
def triplo (n):
num = n * 3
return num | 3.296875 | 3 |
fem/gui/vtk_widget/vtk_graphics/pipelines/visible/__init__.py | mjredmond/FEMApp | 1 | 12767696 | from __future__ import print_function, absolute_import
from .visible_filter import VisibleFilter
from .visible_pipeline import VisiblePipeline
from .visible_selection import VisibleSelection
| 1.023438 | 1 |
tests/test_core.py | cjolowicz/retrocookie | 15 | 12767697 | """Tests for core module."""
from dataclasses import dataclass
from pathlib import Path
import pytest
from .helpers import append
from .helpers import branch
from .helpers import touch
from .helpers import write
from retrocookie import core
from retrocookie import git
from retrocookie import retrocookie
def in_temp... | 2.5 | 2 |
tomotopy/__init__.py | adbmd/tomotopy | 1 | 12767698 | <filename>tomotopy/__init__.py<gh_stars>1-10
"""
Python package `tomotopy` provides types and functions for various Topic Model
including LDA, DMR, HDP, MG-LDA, PA and HPA. It is written in C++ for speed and provides Python extension.
.. include:: ./documentation.rst
"""
from tomotopy._version import __version__
impo... | 2.25 | 2 |
app/recipe/test/test_tag_api.py | Webins/recipe-app-api | 1 | 12767699 | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from core.models import Tag, Recipe
from recipe.serializers import TagSerializer
TAG_URL = reverse('recipe:tag-list')
class Publ... | 2.609375 | 3 |
src/Eukaryotic_Promoters_Classification/mouse_non_tata_deepromoter/DeePromoter.py | Shujun-He/Nucleic-Transformer | 12 | 12767700 | import random
import torch
import numpy as np
from torch import nn
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import Dataset, DataLoader, random_split
from torchvision import transforms, utils
class ParallelCNN(nn.Module):
def __init__(self, para_ker, pool_kernel=6, drop=0.5):
"""
... | 2.78125 | 3 |
catkin_ws/src/10-lane-control/line_detector2/include/line_detector2_tests/single_image_histogram.py | yxiao1996/dev | 2 | 12767701 | <reponame>yxiao1996/dev
from collections import OrderedDict
from comptests.registrar import comptest, run_module_tests
import os
import cv2
from duckietown_utils.download import download_if_not_exist
from duckietown_utils.jpg import image_cv_from_jpg_fn
from duckietown_utils.path_utils import get_ros_package_path
fro... | 2.15625 | 2 |
src/main.py | yoshihidesawada/DCUF | 2 | 12767702 | ###
# python main.py ${lam} ${ICF_EPOCH} ${AE_EPOCH} ${DCUF_EPOCH}
###
import sys
import random
import numpy as np
import chainer
import environment as Env
import model as Model
if len(sys.argv) != 5:
print 'error'
print sys.argv
exit(0)
_, lamb, icf_epoch, ae_epoch, dcuf_epoch = sys.argv
def disentang... | 2.5625 | 3 |
utils/wfuzzbasicauthbrute/wfuzz/plugins/scripts/robots.py | ismailbozkurt/kubebot | 171 | 12767703 | <reponame>ismailbozkurt/kubebot
import re
from urlparse import urlparse, urljoin
from framework.plugins.api import DiscoveryPlugin
from framework.plugins.api import url_filename
from externals.moduleman.plugin import moduleman_plugin
@moduleman_plugin
class robots(DiscoveryPlugin):
name = "robots"
descriptio... | 2.53125 | 3 |
tolteca/web/templates/userlog.py | dennis-l/tolteca | 2 | 12767704 | <reponame>dennis-l/tolteca
#! /usr/bin/env python
from dasha.web.templates import ComponentTemplate
import dash_html_components as html
import dash_bootstrap_components as dbc
import dash_core_components as dcc
from dasha.web.extensions.db import dataframe_from_db
from dasha.web.templates.common import LiveUpdateSect... | 1.710938 | 2 |
src/vater/request_types.py | myslak71/vater | 2 | 12767705 | """This module contains logic for different API request types."""
import datetime
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional, Tuple, Union
import requests
from requests import Response
from vater.errors import (
ERROR_CODE_MAPPING,
InvalidRequestData,
MaximumParameter... | 2.703125 | 3 |
app/models.py | Linyameng/alphadata-dev | 0 | 12767706 | # -*- coding: utf-8 -*-
"""
Created on 2018/5/24
@author: <NAME>
"""
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask_login import UserMixin, AnonymousUserMixin
from flask import current_app
from . import login_m... | 2.296875 | 2 |
ResponseML/crawler/firestore.py | deliciafernandes/Response-Disaster-Management | 1 | 12767707 | <reponame>deliciafernandes/Response-Disaster-Management<filename>ResponseML/crawler/firestore.py
#####################################Data class
class RealNews(object):
def __init__(self, date, headline, description,distype, url="", imageurl="",location=""):
self.date = date
self.headline = headli... | 3.296875 | 3 |
azext_iot/central/providers/export_provider.py | lucadruda/azure-iot-cli-extension | 1 | 12767708 | <reponame>lucadruda/azure-iot-cli-extension
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------... | 1.757813 | 2 |
classfile/member_info.py | kimi641/pyJVM | 0 | 12767709 | <filename>classfile/member_info.py
from typing import List
from classfile.class_read import ClassReader
from classfile.attribute_info import readAttributes,CodeAttribute,ConstantValueAttribute
class MemberInfo:
def __init__(self,
cp,
accessFlags,
nameIndex,
... | 2.78125 | 3 |
solutions/flask-adopt-solution/part-1/models.py | demohack/nonpub | 0 | 12767710 | <gh_stars>0
"""Models for adopt app."""
from flask_sqlalchemy import SQLAlchemy
GENERIC_IMAGE = "https://mylostpetalert.com/wp-content/themes/mlpa-child/images/nophoto.gif"
db = SQLAlchemy()
class Pet(db.Model):
"""Adoptable pet."""
__tablename__ = "pets"
id = db.Column(db.Integer, primary_key=True)
... | 2.8125 | 3 |
bicicleta.py | PaloBraga/Helloworld-Python | 0 | 12767711 | bicicleta=["bike","cannon","cargo", "CALOI"]
#Armazenamento de farias mensagens/lista em uma string
print(bicicleta[0].title())
print(bicicleta[1])
print(bicicleta[2])
print(bicicleta[3])
print(bicicleta[-1])
print(bicicleta[-2])
print(bicicleta[-3])
print(bicicleta[-4].title())
#como... | 4.125 | 4 |
setup.py | trenton42/txwac | 0 | 12767712 | import re
try:
import setuptools
except ImportError:
import distutils.core
setup = distutils.core.setup
else:
setup = setuptools.setup
setup(
name='txwac',
version=(re
.compile(r".*__version__ = '(.*?)'", re.S)
.match(open('txwac.py').read())
.group(1)),... | 1.695313 | 2 |
data-prep/dictionary-comprehension.py | Omelette-du-croissant/da-ta | 0 | 12767713 | <filename>data-prep/dictionary-comprehension.py
import random
# Key: word, value: character count
# Example list with random sentences (from https://randomwordgenerator.com/sentence.php):
sentences = ["The chic gangster liked to start the day with a pink scarf.", "The wooden spoon couldn’t cut but left emotional scars... | 3.90625 | 4 |
src/DH/State.py | fgwy/uavSim | 30 | 12767714 | <gh_stars>10-100
import numpy as np
from src.Map.Map import Map
from src.StateUtils import pad_centered
from src.base.BaseState import BaseState
class DHScenario:
def __init__(self):
self.device_idcs = []
self.device_data = []
self.position_idx = 0
self.movement_budget = 100
clas... | 2.71875 | 3 |
hapycolor/visual.py | rvdz/hapycolor | 1 | 12767715 | <reponame>rvdz/hapycolor
""" Utilitary methods to display ouputs """
# Add color to a string
def str_color(message, rgbcol):
r, g, b = rgbcol
return "\033[38;2;{};{};{}m{}\033[0m".format(r, g, b, message)
# print(squares from a palette)
def print_palette(rgbcols, size=2):
str_palette = ""
for col in... | 3.390625 | 3 |
sdk/keyvault/azure-keyvault/azure/keyvault/v7_3_preview/models/action_py3.py | mccoyp/azure-keyvault-7.3-preview | 0 | 12767716 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.882813 | 2 |
code/rsfc-roi2roi.py | NBCLab/PACE | 0 | 12767717 | <reponame>NBCLab/PACE
import argparse
import os
import os.path as op
from glob import glob
from shutil import copyfile
import pandas as pd
def _get_parser():
parser = argparse.ArgumentParser(description="Run RSFC in AFNI")
parser.add_argument(
"--clean_dir",
dest="clean_dir",
required... | 2.296875 | 2 |
16str_bin_convert.py | Eric-Matrix/tools | 0 | 12767718 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import os
import struct
"""
python str16_bin_convert.py file(can include path)
"""
#input file
#output file
def Str16_to_binFile(inputpath, outpath):
with open(inputpath, 'r') as f:
str_buffer = f.read()
#print(str_buffer)
with open(ou... | 3.515625 | 4 |
level1/jupfits/FitJupObservation.py | SharperJBCA/COMAPAnalysis | 1 | 12767719 | import numpy as np
from matplotlib import pyplot
try:
import ConfigParser
except ModuleNotFoundError:
import configparser as ConfigParser
import argparse
import h5py
from scipy.signal import savgol_filter
import Pointing
from os import listdir, getcwd
from os.path import isfile, join
import Mapping
import Point... | 1.984375 | 2 |
python/popart.ir/python_files/ops/group_norm.py | gglin001/popart | 0 | 12767720 | <filename>python/popart.ir/python_files/ops/group_norm.py
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
from typing import Optional
import popart._internal.ir as _ir
from popart.ir.context import get_current_context
from popart.ir.tensor import Tensor
from .utils import check_in_graph
__all__ = ['group_norm... | 2.140625 | 2 |
NoteBooks/Curso de Python/Python/Core/Decoradores/Clases_decoradores.py | Alejandro-sin/Learning_Notebooks | 1 | 12767721 | <reponame>Alejandro-sin/Learning_Notebooks<filename>NoteBooks/Curso de Python/Python/Core/Decoradores/Clases_decoradores.py
'''
Decoradores y clases.
update_wrapper:
Para evitar que el efecto de wrap suceda se usa en este aso al ser una clase
Es necesario que la clase sea llamable. Por lo que se implementa el méto... | 3.8125 | 4 |
tests/test_apps/helloworld/wsgi.py | fphonor/flask | 52 | 12767722 | <reponame>fphonor/flask
from hello import app
| 1.023438 | 1 |
ml_params/utils.py | SamuelMarks/ml-params | 2 | 12767723 | """
Collection of utility functions
"""
from copy import deepcopy
from functools import partial
from inspect import getmembers
from operator import itemgetter
from os import environ, path
from sys import version_info
def camel_case(st, upper=False):
"""
Convert string to camel-case (upper or lower)
:para... | 2.5 | 2 |
sanic_oauthlib/utils.py | Lupino/sanic-oauthlib | 0 | 12767724 | <reponame>Lupino/sanic-oauthlib<filename>sanic_oauthlib/utils.py
# coding: utf-8
import base64
import importlib
from sanic.response import HTTPResponse
from oauthlib.common import to_unicode
def _get_uri_from_request(request):
"""
The uri returned from request.uri is not properly urlencoded
(sometimes it... | 2.265625 | 2 |
linkace_cli/api/search.py | vwheezy22/linkace-cli | 3 | 12767725 | from linkace_cli.api.base import APIBase
from linkace_cli import models
from linkace_cli.api.tags import Tags
from linkace_cli.api.lists import Lists
class Search(APIBase):
def __init__(self, base_url, api_token):
super(Search, self).__init__(base_url, api_token)
self.tags = Tags(base_url, api_to... | 2.28125 | 2 |
test/mock_helpers.py | yeastgenome/SGDBackend-Nex2 | 5 | 12767726 | from src.models import AlleleGeninteraction, Alleledbentity, Complexdbentity, CurationReference, Dnasequenceannotation, Functionalcomplementannotation, Literatureannotation, Locusdbentity, Pathwaydbentity, Proteinabundanceannotation, Referencedbentity
from . import fixtures as factory
from mock import Mock
class MockQ... | 2.25 | 2 |
test/test_preprocess_emotion.py | SvenElyes/Textanalytics | 1 | 12767727 | <reponame>SvenElyes/Textanalytics
import unittest
import pandas as pd
import os
import pytest
import numpy as np
from pandas.testing import assert_frame_equal
import src.preprocess_emotion as preprocess_emotion
class Test_preprocess_emotion(unittest.TestCase):
def test_clearText(self):
test = "this IS ... | 3.09375 | 3 |
dvmvs/layers.py | hashi0203/deep-video-mvs | 1 | 12767728 | <reponame>hashi0203/deep-video-mvs
import torch
def down_conv_layer(input_channels, output_channels, kernel_size):
return torch.nn.Sequential(
torch.nn.Conv2d(
input_channels,
output_channels,
kernel_size,
padding=(kernel_size - 1) // 2,
stride=1... | 2.328125 | 2 |
Arithmatic/sub/Subtraction.py | MuditMaurya/Calculator | 1 | 12767729 | <filename>Arithmatic/sub/Subtraction.py<gh_stars>1-10
class Subtract:
def __init__(self,fnum,snum):
self.fnum=fnum
self.snum=snum
def allSub(self):
self.sub=self.fnum-self.snum
return self.sub | 2.90625 | 3 |
university_example.py | ericoc/indego-py-lib | 5 | 12767730 | <filename>university_example.py<gh_stars>1-10
from indego import Indego
# Instantiate the Indego class
indego = Indego()
# Retrieve and print "university" stations
uni_stations = indego.get_stations('university')
print(uni_stations)
# Show how many stations were returned above
uni_count = len(uni_stations)
print(uni... | 3.5 | 4 |
athanor_entity/entities/handlers.py | volundmush/athanor_entity | 0 | 12767731 | <gh_stars>0
from django.conf import settings
from evennia import GLOBAL_SCRIPTS
from evennia.utils.utils import class_from_module
from evennia.objects.objects import ObjectSessionHandler
class KeywordHandler(object):
def __init__(self, owner):
self.owner = owner
def all(self, looker=None):
p... | 2.078125 | 2 |
test/TestRelationalPickle.py | mjpan/pypatterns | 0 | 12767732 | from __future__ import with_statement
import os
import pickle
import sys
import unittest
import logging
APP_ROOT = os.getenv('APP_ROOT')
import currypy
#import pypatterns.filter as FilterModule
#import pypatterns.relational as RelationalModule
sys.path.insert(0,"../data")
class TestCase(unittest.TestCase):
"... | 2.453125 | 2 |
setup.py | UCSC-nanopore-cgl/NaRLE | 0 | 12767733 | <filename>setup.py
from version import version, required_versions
from setuptools import find_packages, setup
kwargs = dict(
name='toil-narle',
version=version,
description="UCSC CGL Nanopore Toil pipeiline",
author='UCSC Computational Genomics Lab',
author_email='<EMAIL>',
url="https://github... | 1.351563 | 1 |
code/day08_joe.py | denis-spe/my_advent2020 | 1 | 12767734 | from __future__ import annotations
from typing import NamedTuple, List
RAW = """nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6"""
class Instruction(NamedTuple):
op: str
arg: int
@staticmethod
def parse(line: str) -> Instruction:
op, arg = line.strip().split(" ")
retu... | 3.234375 | 3 |
pokeyadventure/game_objects/tiles.py | wnormandin/PokeyAdventure | 0 | 12767735 | <filename>pokeyadventure/game_objects/tiles.py
import pygame
import os
import random
import sys
import pdb
from .core import GameObject
class Tile(GameObject):
def __init__(self, pos):
super().__init__(pos)
self.passable = True # Determines whether char can pass through tile
self.loc... | 2.734375 | 3 |
d7a/system_files/dll_config.py | christophevg/pyd7a | 3 | 12767736 | <gh_stars>1-10
import struct
from d7a.support.schema import Validatable, Types
from d7a.system_files.system_file_ids import SystemFileIds
class DllConfigFile(Validatable):
SCHEMA = [{
"active_access_class": Types.INTEGER(min=0, max=20),
"vid": Types.INTEGER(min=0, max=0xFFFF)
# TODO others
}]
def ... | 2.28125 | 2 |
snips_nlu/tests/test_version.py | ddorian/snips-nlu | 1 | 12767737 | <filename>snips_nlu/tests/test_version.py
from semantic_version import Version
from snips_nlu import __model_version__, __version__
from snips_nlu.tests.utils import SnipsTest
class TestVersion(SnipsTest):
def test_version_should_be_semantic(self):
# Given
version = __version__
# When
... | 2.5625 | 3 |
flask_test.py | Zihang97/News_Analyzer_app | 1 | 12767738 | from flask import Flask, escape, request, redirect, url_for, render_template
from database import *
from news import *
app = Flask(__name__)
@app.route('/register/', methods=['GET','POST'])
def regist():
if request.method =='POST':
username = request.form['username']
password = request.form['passw... | 3.171875 | 3 |
tcc-teste.py | felipetomm/POX-Django | 1 | 12767739 | <reponame>felipetomm/POX-Django
#!/usr/bin/python2.7
import time
from threading import Thread
import threading, Queue
class cabeca(object):
def __init__(self):
self.nome = None
def check_infos(user_id, queue):
result = user_id+5*2+4*20
queue.put(result)
def soma(i):
return i+5*2+4*20
queue... | 2.609375 | 3 |
TwitterAnalysis/config.py | victorreyes93/Udacity-DevOps-Capstone-Project | 0 | 12767740 | KEY = '<KEY>
| 1.132813 | 1 |
src/nhl_analysis/example.py | pjordan34/nhl_analysis | 0 | 12767741 | import pandas as pd
from aggregate import team_goals
from transform import transform
pbp = pd.read_csv('data/nhl_pbp20172018.csv')
# note that you can use the "uncleaned pbp files in this code,
# you just will not be able to index on the the standard three-letter abbreviations for all teams
print(team_goals(pbp))
p... | 2.6875 | 3 |
lstm/model.py | KalllN/stock-price-lstm | 0 | 12767742 | <reponame>KalllN/stock-price-lstm
model = Sequential()
model.add(LSTM(50, return_sequences = True, input_shape = (x_train.shape[1], 1)))
model.add(LSTM(50, return_sequences = False))
model.add(Dense(25))
model.add(Dense(1))
#Compiling the model
model.compile(optimizer = 'adam', loss = 'mean_squared_error')
#using rmse... | 3.109375 | 3 |
replica/contrib/whisper/urls.py | underlost/Replica | 0 | 12767743 | <reponame>underlost/Replica<filename>replica/contrib/whisper/urls.py
from __future__ import absolute_import
from django.conf.urls import *
from django.views.generic import TemplateView
from django.views.decorators.cache import cache_page
urlpatterns = patterns('',
)
| 1.304688 | 1 |
importers/unsdg_indicator.py | codeforIATI/codelist-updater | 1 | 12767744 | <filename>importers/unsdg_indicator.py
from .helpers import Importer
def run():
url = 'https://docs.google.com/spreadsheets/d/1o1SQDqfFTBgUJO2k83mfFlLtgpwUUkEbc3gjRgIWJSo/export?format=csv&id=1o1SQDqfFTBgUJO2k83mfFlLtgpwUU<KEY>WJSo&gid=1990382168'
lookup = [
('code', 'code'),
('name_en', 'name... | 2.234375 | 2 |
pieces/knight.py | Jone1/chessPyQt | 0 | 12767745 | <reponame>Jone1/chessPyQt
from pieces.piece import AbstractPiece
__author__ = 'Jone'
class Knight(AbstractPiece):
src_white = "D:/workspace/chessQt/chessQt/gfx/nw.png"
src_black = "D:/workspace/chessQt/chessQt/gfx/nb.png"
def __init__(self, x, y, color):
super(Knight, self).__init__(x, y, color... | 3.09375 | 3 |
notebook/utils/.ipynb_checkpoints/viz-checkpoint.py | aws-samples/automl-blueprint | 3 | 12767746 | <gh_stars>1-10
import json
import os
import matplotlib.pyplot as plt
import ipywidgets as widgets
from ipywidgets import interact, interactive, fixed, interact_manual
import seaborn as sns
import pandas as pd
import numpy as np
import shap
from sklearn.metrics import roc_curve, auc, RocCurveDisplay, confusion_matrix
... | 2.078125 | 2 |
aws-hub-account/functions/aws/fetch-aws-findings.py | infviz-io/cloud-security-console | 0 | 12767747 | <filename>aws-hub-account/functions/aws/fetch-aws-findings.py
import json
import os
import boto3
import stdFn
def request_handler(event,context):
#print(event)
try:
# Get security hub findings
shClient=boto3.client('securityhub')
findings=shClient.get_findings(MaxResults=100)['Findings'... | 2.046875 | 2 |
tests/components/camera/test_dispatcher.py | Norien/Home-Assistant | 2 | 12767748 | """The tests for dispatcher camera component."""
import asyncio
from homeassistant.setup import async_setup_component
from homeassistant.helpers.dispatcher import async_dispatcher_send
@asyncio.coroutine
def test_run_camera_setup(hass, test_client):
"""Test that it fetches the given dispatcher data."""
yield... | 2.546875 | 3 |
src/test_results_parsing/test_cutest_parser.py | AAU-PSix/canary | 0 | 12767749 | import unittest
from test_results_parsing.parser_cutest import CuTestParser, FailedCuTest
from typing import List
from . import *
class TestCutestParser(unittest.TestCase):
def setUp(self) -> None:
return super().setUp()
def test_parse_string_with_colon(self) -> None:
# Arrange
self._... | 3.03125 | 3 |
ASK/fixtures/params.py | dmchu/ASK_Selenium | 0 | 12767750 | import os
import random
cwd = os.path.abspath(os.getcwd())
location_chrome = "../browsers/chromedriver"
location_firefox = "../browsers/geckodriver"
DOMAIN = "http://local.school.portnov.com:4520/#"
browsers = [
"chrome",
"firefox"
]
BROWSER_TYPE = random.choice(browsers)
CHROME_EXECUTABLE_PATH = os.path.join... | 2.328125 | 2 |