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 |
|---|---|---|---|---|---|---|
python_for_everybody/bs_regex_parse.py | timothyyu/p4e-prac | 0 | 12788151 | from bs4 import BeautifulSoup as Soup
import re
string = '<p>Please click <a href="http://www.dr-chuck.com">here</a></p>'
match = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', string)
html = Soup(string, 'html.parser')
bsm= [a['href'] for a in html.find_all('a')]
match2 = re.findall('"(http.*.*)"',string... | 3.359375 | 3 |
contacts/urls.py | pedrohd21/Agenda-Django | 1 | 12788152 | <reponame>pedrohd21/Agenda-Django
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.contactsList, name='contacts-list'),
path('contact/<int:id>', views.contactsViews, name='contacts-views'),
path('newcontact/', views.newContact, name='new-contact'),
path('edit/<i... | 1.960938 | 2 |
postcipes/unstructured_channel_flow.py | timofeymukha/postcipes | 0 | 12788153 | <filename>postcipes/unstructured_channel_flow.py
# This file is part of postcipes
# (c) <NAME>
# The code is released under the MIT Licence.
# See LICENCE.txt and the Legal section in the README for more information
from __future__ import absolute_import
from __future__ import division
from __future__ import print_fun... | 2.375 | 2 |
bootstrap.py | Borgotto/Parsecbot | 2 | 12788154 | import subprocess
import sys
def start():
# 0x78 == 01111000 == x, eXit
return subprocess.call((sys.executable, "main.py")) == 0x78
if __name__ == "__main__":
print("Executing Bot initialisation.")
while True:
# Start the bot
print("Starting Bot;")
code = start()
if n... | 2.859375 | 3 |
src/SimilarNeuron/exception.py | guanquanchen/similar-neuron | 1 | 12788155 | class SimilarNeuronException(Exception):
def __init__(self, name: str, reason: str) -> None:
self.name = name
self.reason = reason
def __str__(self) -> str:
return f"{self.name}: {self.reason}"
class AnnotationEmpty(SimilarNeuronException):
def __init__(
self,
n... | 3.03125 | 3 |
View/GUI.py | esteban-mendoza/ProyectoFinal | 0 | 12788156 | from tkinter import *
from tkinter import ttk
from View.Datepicker import Datepicker
from Controller.Controller import Controller
from tkinter.filedialog import askopenfilename
"""
Autor: <NAME> (418002863)
Email: <EMAIL>
"""
class GUI(ttk.Frame):
fields_current_query = dict()
def __init__(self, master):
... | 2.9375 | 3 |
454 4Sum II.py | krishna13052001/LeetCode | 872 | 12788157 | #!/usr/bin/python3
"""
Given four lists A, B, C, D of integer values, compute how many tuples (i, j,
k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.
To make problem a bit easier, all A, B, C, D have same length of N where
0 ≤ N ≤ 500. All integers are in the range of -2^28 to 2^28 - 1 and the result
is gu... | 3.140625 | 3 |
MoviesForm/moviesapp/views.py | KiralyTamas/Django | 0 | 12788158 | from django.shortcuts import render
from moviesapp.models import Movies
from moviesapp.forms import MoviesForm
def index(request):
return render(request, 'moviesapp/index.html')
def moviesList(request):
moviesList=Movies.objects.all()
movies_dict={'movies':moviesList}
return render(request, 'moviesapp... | 2.171875 | 2 |
scripts/hello_kitty.py | zodiacfireworks/introduction-to-programming-in-python | 0 | 12788159 | <reponame>zodiacfireworks/introduction-to-programming-in-python
# -*- encoding: utf-8 -*-
print("hello kitty!")
| 2.109375 | 2 |
src/animo.py | MimansaSharma15/Animo | 2 | 12788160 | import streamlit as st
from help import health_analysis
from load_chatmodel import load
from data import main_data
from get_medical import get_links
import torch
from tensorflow.keras.preprocessing.sequence import pad_sequences
encoder_net, decoder_net = load()
data = main_data()
max, vocab_enc, vocab_dec =... | 3.046875 | 3 |
tests/test_log.py | InfluxGraph/influxgraph | 97 | 12788161 | import uuid
import unittest
import influxgraph
from influxdb import InfluxDBClient
class InfluxGraphLogFileTestCase(unittest.TestCase):
def setUp(self):
self.db_name = 'fakey'
self.client = InfluxDBClient(database=self.db_name)
self.client.create_database(self.db_name)
_logger = in... | 2.546875 | 3 |
memory.py | hiroki-kyoto/memory-association-recognition | 0 | 12788162 | # read_dataset.py
# Author : Hiroki
# Modified: 2018-1-10
import cPickle
import matplotlib.pyplot as pl
import numpy as np
def unpickle(file):
with open(file, 'rb') as fo:
dict = cPickle.load(fo)
return dict
def load_dataset():
data = unpickle('cifar-10/data_batch_1')
images = [data['data'][i]... | 3.015625 | 3 |
lightning/admin.py | git-men/bsm-django | 90 | 12788163 | from api_basebone.core.admin import BSMAdmin
Admin = BSMAdmin | 1.125 | 1 |
realtime_csv_to_graph_and_limit_check.py | contengee/realtime_csv_to_graph_and_limit_check | 1 | 12788164 | <gh_stars>1-10
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
import datetime as dt
import tkinter as tk
from tkinter import messagebox
import tkinter.simpledialog as simpledialog
MAX_SET_NUM = 10000
LIMIT_SET_NUM = MAX_SET_NUM * 0.9
UPDATE_TIME = 5
def readyCsv():
server_path = Pat... | 2.609375 | 3 |
categories/customcommand.py | MikeJollie2707/MichaelBot | 0 | 12788165 | import discord
from discord.ext import commands
import datetime as dt
import utilities.db as DB
import utilities.facility as Facility
from bot import MichaelBot
class CustomCommand(commands.Cog, name = "Custom Commands", command_attrs = {"cooldown_after_parsing": True}):
"""Commands that support adding custom c... | 2.578125 | 3 |
demo/host_game.py | hilearn/ai-game | 0 | 12788166 | <gh_stars>0
import socket
from game import Game, RemotePlayer, _3X5Map, PlayerStats, Stats
def main(host, port):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((host, port))
s.listen()
players = [RemotePlayer(s,
stats=PlayerStats(8, 3, ... | 2.578125 | 3 |
construct_call_graph.py | cancer525/pythontest | 0 | 12788167 | #!/usr/bin/env python
'''
generates call graph of given python code file
in dot format input for graphviz.
limitations:
* statically tried to figure out functions calls
* does not understand classes
* algorithm is naive and may not statically find
all cases
'''
import sys
import parser
import symbol, token
import ... | 2.75 | 3 |
etl_nested/tests/unit/test_factories.py | CloverHealth/pycon2017 | 6 | 12788168 | import datetime
import os
import sqlalchemy.orm as sa_orm
from app import factories
from app.etl import transformers
from app.util.json import load_json_file
def test_make_response_from_nested_schema(session: sa_orm.Session, data_dir):
schema = load_json_file(os.path.join(data_dir, 'nested_schema.json'))
fo... | 2.546875 | 3 |
userAgentRandomizer/__init__.py | MattWaller/userAgentRandomizer | 0 | 12788169 | from glob import glob
import os, random
class userAgents(object):
def __init__(self):
files_ = glob(f'{os.path.dirname(os.path.realpath(__file__))}/assets/*.txt')
self.uas,self.Chrome,self.Edge,self.Firefox,self.Opera,self.Safari = [],[],[],[],[],[]
for file_ in files_:
with open(file_,'r') as f:
record... | 2.8125 | 3 |
investments/contrib/tags/models.py | gatsinski/investments | 0 | 12788170 | import uuid
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
from investments.models import TimestampedModel
UserModel = get_user_model()
class Tag(TimestampedModel):
uuid = models.UUIDField(default=uuid.uuid4, primary_key=True)
... | 2.375 | 2 |
server/authentication/utils.py | Arun89-crypto/codechefsrm | 0 | 12788171 | from typing import Any, Dict
from .errors import NoTokenFound, InvalidToken
from . import tokens
def get_token(header: Dict[str, Any]):
if "Authorization" in header:
return header["Authorization"]
raise NoTokenFound()
def validate_token_type(token: str, token_type: str = "Bearer"):
_token_type,... | 2.703125 | 3 |
test/unit/test_yaml_spec.py | izakp/hokusai | 85 | 12788172 | <filename>test/unit/test_yaml_spec.py<gh_stars>10-100
import os
import httpretty
from test import HokusaiUnitTestCase
from hokusai import CWD
from hokusai.lib.exceptions import HokusaiError
from hokusai.services.yaml_spec import YamlSpec
httpretty.enable()
httpretty.HTTPretty.allow_net_connect = False
class TestY... | 2.234375 | 2 |
mbserializer/fields/attribute_fields.py | gomafutofu/mbserializer | 0 | 12788173 | __author__ = '<NAME>'
from .declarations import (
StringAttribute as Str,
IntegerAttribute as Int,
FloatAttribute as Float,
DecimalAttribute as Decimal,
BooleanAttribute as Bool,
DatetimeAttribute as Datetime,
DateAttribute as Date,
EnumAttribute as Enum,
) | 1.695313 | 2 |
lecture-2/loops.py | wendelsilva/CS50-Web-Programming-with-Python-and-JavaScript | 0 | 12788174 | <filename>lecture-2/loops.py
for i in range(6):
print(i)
names = ["Harry", "Ron", "Hermione", "Ginny"]
for name in names:
print(name)
name = "Harry"
for character in name:
print(character) | 4.28125 | 4 |
fewsum/data_pipelines/assemblers/tuning_pipeline.py | mancunian1792/FewSum | 28 | 12788175 | from mltoolkit.mldp.utils.constants.vocabulary import PAD, START, END, UNK
from mltoolkit.mldp import PyTorchPipeline
from mltoolkit.mldp.steps.readers import CsvReader
from mltoolkit.mldp.steps.transformers.nlp import TokenProcessor, VocabMapper, \
SeqLenComputer, Padder, SeqWrapper
from mltoolkit.mldp.steps.gener... | 2.46875 | 2 |
bindings/python/fdb/tenant_management.py | sfc-gh-bvr/foundationdb | 1 | 12788176 | <filename>bindings/python/fdb/tenant_management.py
#
# tenant_management.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2022 Apple Inc. and the FoundationDB project authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | 1.875 | 2 |
ofcourse/tests/test_yaml.py | liam-middlebrook/ofCourse | 0 | 12788177 | <reponame>liam-middlebrook/ofCourse
import os
import yaml
import unittest
from validator import Required, validate, InstanceOf
class TestAllYaml(unittest.TestCase):
def test_recursive_yaml(self):
yaml_files = []
for root, _, fnames in os.walk(os.getcwd()):
for fname in fnames:
... | 2.71875 | 3 |
themis/model/emr_model.py | igor-lema-ifood/themis | 54 | 12788178 | import themis.monitoring.emr_monitoring
import themis.scaling.emr_scaling
from themis.util import aws_common
from themis import config
from themis.model.aws_model import *
class EmrCluster(Scalable, Monitorable):
def __init__(self, id=None):
super(EmrCluster, self).__init__(id)
self.type = None
... | 2.078125 | 2 |
kmodes/__init__.py | sdkugelmass/kmodes | 0 | 12788179 | __version__ = 'nb 0.11.2'
| 1.023438 | 1 |
homeserver/__init__.py | miikama/home-server | 0 | 12788180 |
import sys
import os
import logging
from flask import Flask
HOME_SERVER_DIR = os.path.dirname(os.path.abspath(__file__))
#the absolute path of this script
app_path = os.path.dirname(os.path.realpath(__file__))
#config for the project
from homeserver.server_config import load_config, setup_logging
config = load_... | 2.28125 | 2 |
tests/gen_test_clips.py | sevagh/chord-detection | 55 | 12788181 | #!/usr/bin/env python3.7
import unittest
import numpy
import os
import librosa
import soundfile
import sys
from tempfile import TemporaryDirectory
def main():
dest = "tests/test_1_note_Csharp3.wav"
tone = librosa.tone(138.59, sr=22050, length=44100)
soundfile.write(dest, tone, 22050)
print("Created {... | 2.515625 | 3 |
src/forum/migrations/0018_auto_20170629_2130.py | shashankmohabia/gymkhana-master | 1 | 12788182 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-29 16:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0017_reply'),
]
operations = [
migrations.AlterModelOptions... | 1.53125 | 2 |
examples/example_application.py | samson0v/python_tb_rest_client | 30 | 12788183 | # Copyright 2020. ThingsBoard
# #
# 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 ... | 1.726563 | 2 |
alembic/versions/16c2d576e01e_add_schools_with_description_2020.py | AlonMaor14/anyway | 69 | 12788184 | <reponame>AlonMaor14/anyway
"""add_schools_with_description_2020
Revision ID: 16c2d576e01e
Revises: <PASSWORD>
Create Date: 2020-08-16 10:30:23.748793
"""
# revision identifiers, used by Alembic.
revision = '16c2d576e01e'
down_revision = '7c472e4582de'
branch_labels = None
depends_on = None
from alembic import op
i... | 1.671875 | 2 |
data/simple_analysis.py | tonitick/CacheZoom | 13 | 12788185 | <reponame>tonitick/CacheZoom
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import operator, sys
MAX_MEASUREMENT = 50000
def get_set(addr):
return (addr >> 6) & 0b111111
def calc_threshold(set_stat):
# print '[+] Calculating eviction thresholds...'
threshold = []
for k in set_stat:... | 2.359375 | 2 |
payplug/test/test_init/test_dao_payment.py | SOGEXIS/payplug-python | 0 | 12788186 | <filename>payplug/test/test_init/test_dao_payment.py
# -*- coding: utf-8 -*-
import pytest
from mock import patch
import payplug
from payplug import resources
from payplug.test import TestBase
@patch('payplug.config.secret_key', 'a_secret_key')
@patch.object(payplug.HttpClient, 'post', lambda *args, **kwargs: ({'id':... | 2.15625 | 2 |
oil_lang/grammar_gen.py | msingle/oil | 0 | 12788187 | #!/usr/bin/env python2
"""
grammar_gen.py - Use pgen2 to generate tables from Oil's grammar.
"""
from __future__ import print_function
import os
import sys
from _devbuild.gen.id_kind_asdl import Id, Kind
from _devbuild.gen.syntax_asdl import source
from core import alloc
from core import meta
from core.util import l... | 2.234375 | 2 |
unittest_flow/uf04_testsuite_for_module_uf01.py | RagnorLixiaomeng/apiAssurance | 0 | 12788188 | <reponame>RagnorLixiaomeng/apiAssurance
# -*- coding: utf-8 -*-
# @Time : 2021/5/29 2:28 PM
# @Author: lixiaomeng_someday
# @Email : <EMAIL>
# @File : uf04_testsuite_for_module_uf01.py
import unittest
from apiAssurance.unittest_flow.uf02_test_mathmethod_cases import TestMathMethod
from apiAssurance.unittest_flow.uf0... | 2.078125 | 2 |
tasks/utils.py | RossBrunton/RThing | 0 | 12788189 | <gh_stars>0
"""Utility functions for the tasks app"""
from django.template.loader import render_to_string
from django.template import RequestContext
from django.core.cache import cache
from tasks.templatetags import fragments
from courses.models import get_iface
import random
# This is used to seperate the user outp... | 2.6875 | 3 |
examples/algorithms/algorithms.py | rorodata/lambdapool | 0 | 12788190 | def fibonacci(n):
'''A naive implementation of computing n'th fibonacci number
'''
if n==0: return 0
if n==1: return 1
return fibonacci(n-1) + fibonacci(n-2)
def factorial(n):
'''Returns factorial of a number
'''
if n<0: raise ValueError('Factorial of a negative number does not exist')
... | 4.25 | 4 |
V-generalization/examples/stereo_neural_inference/face_detector_v2.py | Ikomia-dev/ikomia-oakd | 0 | 12788191 | <reponame>Ikomia-dev/ikomia-oakd<gh_stars>0
from pathlib import Path
import depthai as dai
import cv2
import sys
# Importing from parent folder
sys.path.insert(0, str(Path(__file__).parent.parent.parent)) # move to parent path
from utils.draw import drawROI, displayFPS
from utils.OakRunner import OakRunner
frame_wi... | 2.03125 | 2 |
alert_bot.py | nacitar/proxitar | 0 | 12788192 | #!/usr/bin/env python3
# TODO: how will commands handle incorrectly cased names? will need to be able to do that, preferably without losing original case in messages.
# TODO: initial 'all clear'? here, or in main?
# TODO: save 'seen' persistently upon changes?
# TODO: commands, reporting/unique players (later)... | 2.515625 | 3 |
horus_media_examples/list_recordings.py | horus-view-and-explore/horus-media-client | 3 | 12788193 | # Copyright(C) 2020 Horus View and Explore B.V.
import psycopg2
from horus_db import Frames, Recordings, Frame, Recording
# This example shows how to iterate over all the recordings
def get_connection():
return psycopg2.connect(
"dbname=HorusWebMoviePlayer user=postgres password=<PASSWORD>")
connection... | 2.9375 | 3 |
INTEST.py | ankitpipalia/codechef-solutions | 1 | 12788194 | <reponame>ankitpipalia/codechef-solutions<filename>INTEST.py
n, divider = input().split(" ")
n = int(n)
divider = int(divider)
counter = 0
while(n > 0):
n -= 1
value = int(input())
if value % divider == 0:
counter += 1
print(counter) | 3.40625 | 3 |
python/hopsworks/git_provider.py | robzor92/hopsworks-api | 0 | 12788195 | <reponame>robzor92/hopsworks-api
#
# Copyright 2022 Logical Clocks AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 2.09375 | 2 |
alerta/checker/client.py | MailOnline/alerta | 0 | 12788196 | <reponame>MailOnline/alerta
import os
import sys
import subprocess
import shlex
from alerta.common import log as logging
from alerta.common import config
from alerta.common.alert import Alert
from alerta.common.heartbeat import Heartbeat
from alerta.common import severity_code
from alerta.common.api import ApiClient
... | 2.03125 | 2 |
ros/src/twist_controller/twist_controller.py | hssavage/CarND-Capstone | 0 | 12788197 | '''
###############################################################################
# twist_controller.py #
# --------------------------------------------------------------------------- #
# ... | 2.359375 | 2 |
manage.py | zagaran/instant-census | 1 | 12788198 | #!/usr/bin/python
""" DO NOT IMPORT ANYTHING HIGHER UP THAN UTILS IN THE GLOBAL SCOPE.
DOING SO WILL BREAK SERVER SETUP """
import sys
import unittest2 as unittest
from IPython import start_ipython
from utils.local import untracked_file_check, delete_pyc_files
from utils.server import TEST_RUN
COMMANDS = {"shel... | 2.203125 | 2 |
SimpleMaze.py | MarcusRainbow/Maze | 0 | 12788199 | from typing import List, Set, Optional, Tuple
from random import randrange, shuffle, random
from RatInterface import Rat, MazeInfo
from SimpleRats import AlwaysLeftRat, RandomRat
from Localizer import Localizer, NonLocalLocalizer, OneDimensionalLocalizer, TwoDimensionalOneStepLocalizer
from graphviz import Graph
... | 3.484375 | 3 |
vgg16/17flowers/extractor.py | Rumiachang/keras-examples | 0 | 12788200 | import os
#from tensorflow.keras.applications.vgg16 import VGG16
from tensorflow.keras.applications.inception_v3 import InceptionV3
from tensorflow.keras.preprocessing.image import ImageDataGenerator
#from tensorflow.keras.models import Sequential
#from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense... | 2.1875 | 2 |
eb_butterflies_to_CSV.py | acic2017/Butterfly-SDM | 1 | 12788201 | <reponame>acic2017/Butterfly-SDM<filename>eb_butterflies_to_CSV.py
#!/usr/bin/env python
#latin_name, english_name, year, month, latitude, longitude
import pandas as pd
from sqlalchemy import create_engine
query = """
WITH Location AS (SELECT *
FROM eb_butterflies.observations o JOIN eb_central.checklists c on c.... | 2.5625 | 3 |
pyatv/protocols/mrp/protobuf/AudioFadeResponseMessage_pb2.py | crxporter/pyatv | 0 | 12788202 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pyatv/protocols/mrp/protobuf/AudioFadeResponseMessage.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google... | 1.421875 | 1 |
iv/Leetcode/easy/e021_merge_sorted_list.py | iamsuman/iv | 2 | 12788203 | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def make_list(A):
if len(A) == 0:
return None
head = ListNode(A[0])
ptr = head
for i in A[1:]:
ptr.next = ListNode(i)
ptr = ptr.next
... | 3.828125 | 4 |
Living_SDK/board/tg7100cevb/ucube.py | AL-Answer/HF-270-1.6.6 | 12 | 12788204 | <reponame>AL-Answer/HF-270-1.6.6
linux_only_targets="smart_outlet smart_led_bulb"
| 1.257813 | 1 |
scripts/repo.py | mjfwest/OpenMDAO-Framework | 69 | 12788205 | <reponame>mjfwest/OpenMDAO-Framework<gh_stars>10-100
#!/usr/bin/env python
"""
Repository maintenance.
Can record lock/unlock state of a repository.
Useful to keep multiple developers from stepping on each other,
but requires some discipline :-(
"""
import glob
import optparse
import os.path
import platform
import shu... | 2.25 | 2 |
tests/test_plugin_scroll.py | thecarebot/carebot | 50 | 12788206 | <gh_stars>10-100
#!/usr/bin/env python
import app_config
app_config.DATABASE_NAME = 'carebot_test.db'
app_config.DEFAULT_CONFIG_PATH = 'tests/config_test.yml'
try:
import unittest2 as unittest
except ImportError:
import unittest
import datetime
from plugins.npr.scrolldepth import NPRScrollDepth
from util.co... | 2.328125 | 2 |
bots_detector/models/base_model.py | cloutavista/bot-detector | 0 | 12788207 | <gh_stars>0
### This script will be responsible for building a model, optionally leveraging a training set ###
from abc import ABC
class Model(ABC):
def train(self):
return NotImplemented
def predict(self, profile):
return NotImplemented | 2.375 | 2 |
src/python3/dsv/commands/find_node_id.py | MikeAT/visualizer | 6 | 12788208 | #!/usr/bin/env python3
#
# Copyright 2018-2020 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# Developed by S... | 2.375 | 2 |
getpw/__init__.py | N0x1s/getpw | 2 | 12788209 | <reponame>N0x1s/getpw
from .main import getpw
| 1.046875 | 1 |
haven/haven_jobs/slurm_manager.py | liuzheyu1998/haven-ai | 0 | 12788210 | <filename>haven/haven_jobs/slurm_manager.py
from .. import haven_utils as hu
from .. import haven_chk as hc
import os
import time
import copy
import pandas as pd
import numpy as np
import getpass
import pprint
import requests
# Job submission
# ==============
def submit_job(api, account_id, command, ... | 2.015625 | 2 |
Python/gksdudaovld/MapperTest.py | ForestHouse2316/gksdudaovld | 0 | 12788211 | from gksdudaovld import KoEngMapper as Mapper
from SimpleTester import SimpleTester
tester = SimpleTester("./test_en2ko.txt", Mapper.conv_en2ko)
print(tester.start().log)
# tester = SimpleTester("./test_ko2en.txt", Mapper.conv_ko2en)
# print(tester.start().log) | 2 | 2 |
sudoku.py | pkmatador/simple_sudoku_solver | 0 | 12788212 | <gh_stars>0
# coding: utf-8
import numpy as np
from collections import defaultdict
sudoku = np.array(
[[5, 1, 7, 6, 0, 0, 0, 3, 4],
[2, 8, 9, 0, 0, 4, 0, 0, 0],
[3, 4, 6, 2, 0, 5, 0, 9, 0],
[6, 0, 2, 0, 0, 0, 0, 1, 0],
[0, 3, 8, 0, 0, 6, 0, 4, 7],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 9, 0, 0, 0, 0, 0, 7, 8],
[7, 0... | 3.609375 | 4 |
tests/test_treeview.py | vhn0912/pygubu | 0 | 12788213 | <gh_stars>0
# encoding: utf8
import os
import sys
import unittest
import tkinter as tk
import tkinter.ttk as ttk
pygubu_basedir = os.path.abspath(os.path.dirname(
os.path.dirname(os.path.realpath(sys.argv[0]))))
if pygubu_basedir not in sys.path:
sys.path.insert(0, pygubu_basedir)
import pygubu
import suppor... | 2.34375 | 2 |
hubblestack/__init__.py | instructure/hubble | 2 | 12788214 | <filename>hubblestack/__init__.py
__version__ = '4.0.0'
__buildinfo__ = {'branch': 'BRANCH_NOT_SET', 'last_commit': 'COMMIT_NOT_SET'} | 1.3125 | 1 |
nestingnote/test_nestedlist.py | woodsonmiles/nested-notes | 0 | 12788215 | <reponame>woodsonmiles/nested-notes
#!/usr/bin/python3
import unittest
from nestingnote.nestedlist import NestedList, NullNestedList
from typing import List
class TestNestedList(unittest.TestCase):
def test_instantiation(self):
root = NestedList()
self.assertTrue(isinstance(root, NestedList))
... | 3.46875 | 3 |
tests/unit/test_sitri.py | Egnod/sitri | 11 | 12788216 | <gh_stars>10-100
import pytest
from sitri import Sitri
def test_sitri_init():
with pytest.raises(TypeError):
Sitri()
def test_sitri_get_config(test_sitri, monkeypatch):
monkeypatch.setenv("TEST_KEY1", "1")
monkeypatch.setenv("TEST_KEY2", "2")
assert test_sitri.get("key1") == "1"
assert... | 2.234375 | 2 |
easymunk/pygame/draw_options.py | fabiommendes/easymunk | 1 | 12788217 | <filename>easymunk/pygame/draw_options.py
from typing import Sequence, Tuple
import pygame
from ..drawing import DrawOptions as DrawOptionsBase, Color
from ..linalg import Vec2d
class DrawOptions(DrawOptionsBase):
_COLOR = DrawOptionsBase._COLOR
surface: pygame.surface.Surface
def __init__(self, surfac... | 4.34375 | 4 |
macstats/cpu.py | cloverstd/macstats-python | 1 | 12788218 | <filename>macstats/cpu.py<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
from . import _smc
class CPU(object):
@property
def temp(self, F=False):
_temp = _smc.temp()
return (_temp * (9.0 / 5.0)) + 32.0 if F else _temp
cpu = CPU()
| 2.71875 | 3 |
src/call.py | Ewpratten/dirobium | 0 | 12788219 | <reponame>Ewpratten/dirobium
import os
import sys
import registers as registers
sys.path.append(os.getcwd() + "/devices")
def call(callid):
if str(callid) == "0":
exit(0)
if str(callid) == "11":
print(registers.stack[registers.read_only[0] - 1])
else:
calls[str(callid)].call(registers.general, registers.exte... | 2.140625 | 2 |
book_figures/chapter1/fig_NASA_atlas.py | autocorr/astroML | 3 | 12788220 | <reponame>autocorr/astroML
"""
NASA Atlas dataset example
--------------------------
"""
# Author: <NAME>
# License: BSD
# The figure produced by this code is published in the textbook
# "Statistics, Data Mining, and Machine Learning in Astronomy" (2013)
# For more information, see http://astroML.github.com
# T... | 2.859375 | 3 |
tests/components/nanoleaf/test_config_flow.py | hnrkp/core | 1 | 12788221 | """Test the Nanoleaf config flow."""
from unittest.mock import patch
from pynanoleaf import InvalidToken, NotAuthorizingNewTokens, Unavailable
from homeassistant import config_entries
from homeassistant.components.nanoleaf.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_TOKEN
from homeassistant.co... | 2.21875 | 2 |
w3resource/BeautifulSoup/BeautifulSoup08.py | DanielPascualSenties/pythonw3 | 0 | 12788222 | import urllib
from bs4 import BeautifulSoup
from urllib import request
page = urllib.request.urlopen('https://www.python.org')
st = page.read()
soup = BeautifulSoup(st, 'html.parser')
print("Text in the first a tag:")
li = soup.find_all("li")
for i in li:
a = i.find('a')
print(a.attrs['href'])
| 3.421875 | 3 |
app/models/commons.py | medsci-tech/mime_analysis_flask_2017 | 0 | 12788223 | <reponame>medsci-tech/mime_analysis_flask_2017
from . import db
class Disease(db.Model):
__tablename__ = 'disease'
id = db.Column(db.Integer(), primary_key=True)
name_ch = db.Column('name_ch', db.String(30), nullable=False)
class Region(db.Model):
__tablename__ = 'region'
id = db.Column(db.Integ... | 2.375 | 2 |
ietf/test/mirror-test.py | lafrenierejm/ietf-cli | 0 | 12788224 | #!/usr/bin/env python3
import os
import sys
import unittest
from ietf.cmd.mirror import assemble_rsync
class TestAssembleRsync(unittest.TestCase):
boilerplate = ['rsync', '-az', '--delete-during']
rsync_no_path = (('charter', boilerplate +
['ietf.org::everything-ftp/ietf/']),
... | 2.1875 | 2 |
v3/serializer.py | bwisgood/FRF | 3 | 12788225 | <reponame>bwisgood/FRF<filename>v3/serializer.py
from inspect import ismethod
from datetime import datetime
from .exceptions import ArgumentException
class Serializer(object):
model_class = None
fields = "__all__"
extend_fields = None
logical_delete = {"is_delete": 0}
data_time_format = "%Y/%m/%d... | 2.40625 | 2 |
examples/extension.py | TuXiaokang/karas | 3 | 12788226 | <reponame>TuXiaokang/karas<gh_stars>1-10
import torch
from karas.training import extension
class Eval(extension.Extension):
def initialize(self, trainer):
pass
def __call__(self, trainer):
updater = trainer.updater
reporter = trainer.reporter
loader = trainer.get_loader('test... | 2.125 | 2 |
hanoi/subscriber.py | emmanueltech1/edgex-go | 0 | 12788227 | # Subscribers are created with ZMQ.SUB socket types.
# A zmq subscriber can connect to many publishers.
import sys
import zmq
import base64
import simplejson as json
port = "5563"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
# Socket to talk to server
context = zmq.Context()
socket = context.socket(zmq... | 2.953125 | 3 |
tests/test_log.py | elifesciences/elife-bot | 17 | 12788228 | <reponame>elifesciences/elife-bot
import logging
import log
import unittest
class TestLog(unittest.TestCase):
def test_logger_creation_and_usage(self):
logger = log.logger("worker.log", "INFO", "worker_123")
self.assertIsInstance(logger, logging.Logger)
logger.info("Test info message")
... | 2.6875 | 3 |
auraliser/realtime.py | FRidh/auraliser | 2 | 12788229 | import numpy as np
import itertools
from scintillations.stream import modulate as apply_turbulence
from scintillations.stream import transverse_speed
from streaming.stream import Stream, BlockStream
from streaming.signal import *
import streaming.signal
import logging
from acoustics.signal import impulse_response_real... | 2.5 | 2 |
exam_reader/cli.py | 9kin/exam-reader | 1 | 12788230 | import subprocess
import sys
import time
from pathlib import Path
import click
from .database import Job, db
from .lint import lint
from .pdf_reader import pdf_workers
from .utils import add_files
dir = Path(__file__).resolve().parent.parent
@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx... | 2.21875 | 2 |
setup.py | 1313e/viscm | 1 | 12788231 | from setuptools import setup, find_packages
import sys
import os.path
# Must be one line or PyPI will cut it off
DESC = ("A colormap tool")
LONG_DESC = open("README.rst").read()
setup(
name="viscm",
version="0.10.0",
description=DESC,
long_description=LONG_DESC,
author="<NAME>, <NAME>, <NAME>",
... | 1.445313 | 1 |
src/modules/snowflake/sync-connector/sync-connector-lambda/snowflake_export.py | aws-samples/aws-iot-twinmaker-samples-snowflake | 1 | 12788232 | <reponame>aws-samples/aws-iot-twinmaker-samples-snowflake
#!/usr/bin/env python
import argparse
import json
import os
import snowflake.connector
from snowflake.connector import DictCursor
import time
from library import *
'''
Read the model meta-data (queried from snowflake) and convert it into a Iottwinmaker entiti... | 2.25 | 2 |
PeterMaar-NetLrnChatBot/Client/ClientTerminal.py | alset333/NetworkedLearningChatbot | 3 | 12788233 | <reponame>alset333/NetworkedLearningChatbot
#!/usr/bin/env python3
# ClientTerminal.py
import time
import socket
__author__ = '<NAME>'
__version__ = '0.1.0'
def send(ip, port, message):
udp_ip = ip
udp_port = port
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRA... | 3.28125 | 3 |
DocTAG_Dockerized/DocTAG_App/utils_configuration_and_update.py | DocTAG/doctag-core | 4 | 12788234 | <filename>DocTAG_Dockerized/DocTAG_App/utils_configuration_and_update.py<gh_stars>1-10
from DocTAG_App.utils import *
from psycopg2.extensions import register_adapter, AsIs
def addapt_numpy_float64(numpy_float64):
return AsIs(numpy_float64)
def addapt_numpy_int64(numpy_int64):
return AsIs(numpy_int64)
register_... | 2.203125 | 2 |
tests/test_context_processors.py | uktrade/directory-header-footer | 1 | 12788235 | from unittest.mock import Mock
import pytest
from directory_header_footer import context_processors
from directory_constants.constants import urls as default_urls
@pytest.fixture
def sso_user():
return Mock(
id=1,
email='<EMAIL>'
)
@pytest.fixture
def request_logged_in(rf, sso_user):
re... | 2.171875 | 2 |
nova_powervm/tests/virt/powervm/nvram/fake_api.py | openstack/nova-powervm | 24 | 12788236 | <filename>nova_powervm/tests/virt/powervm/nvram/fake_api.py<gh_stars>10-100
# Copyright 2016, 2017 IBM Corp.
#
# 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
... | 2.46875 | 2 |
csp/admin.py | jsocol/django-csp | 2 | 12788237 | <gh_stars>1-10
from django.contrib import admin
from csp.models import Group, Report
class GroupAdmin(admin.ModelAdmin):
fields = ('name', 'identifier',)
list_display = ('name', 'identifier', 'count',)
readonly_fields = ('identifier',)
def has_add_permission(*a, **kw):
return False
class R... | 2.125 | 2 |
examples/mocsar_pl_human.py | cogitoergoread/muszi-macrohard.hu | 1 | 12788238 | """
A toy example of playing against random bot on Mocsár
Using env "mocsar" and 'human_mode'. It implies using random agent.
"""
import rlcard3
# Make environment and enable human mode
env = rlcard3.make(env_id='mocsar', config={'human_mode': True})
# Reset environment
state = env.reset()
while not env.is_over():
... | 3.140625 | 3 |
tests/test_env.py | timgates42/flask-assets | 0 | 12788239 | <reponame>timgates42/flask-assets
import os
from nose.tools import assert_raises
from flask import Flask
from flask_assets import Environment, Bundle
class TestEnv:
def setup(self):
self.app = Flask(__name__)
self.env = Environment(self.app)
self.env.debug = True
self.env.register... | 2.296875 | 2 |
tests/gbe/test_coordinator_performer_autocomplete.py | bethlakshmi/gbe-divio-djangocms-python2.7 | 1 | 12788240 | <reponame>bethlakshmi/gbe-divio-djangocms-python2.7<filename>tests/gbe/test_coordinator_performer_autocomplete.py
from django.test import TestCase
from django.test import Client
from django.urls import reverse
from tests.factories.gbe_factories import (
PersonaFactory,
ProfileFactory,
TroupeFactory,
)
from ... | 2.234375 | 2 |
tests/test_core.py | mbannick/CorrelatedCounts | 3 | 12788241 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
test_core
~~~~~~~~~
Test the core module
"""
import numpy as np
import pytest
import ccount.core as core
import ccount.utils as utils
# test problem
m = 5
n = 3
l = 1
d = np.array([[2]*n]*l)
Y = np.random.randn(m, n)
X = [[np.random.randn(m, d[k, j])
for j... | 2.046875 | 2 |
scripts/analyzeSignals.py | simras/CAP | 1 | 12788242 | <filename>scripts/analyzeSignals.py
#!/usr/bin/python
# agrep.py
# Example cat seqs.fa | agrep.py -p gcttcatagccccttcccaat -m 3
# By <NAME>
# Bioinformatics Centre
# University of Copenhagen
# gcttcatagccccttcccaat
from types import *
def analyzeSignals(fn):
import os
import sys
from operator... | 2.65625 | 3 |
skype.py | divyanshupandey/face-recognize-ml | 0 | 12788243 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 14 13:04:49 2017
@author: acer
"""
from skpy import Skype
from getpass import getpass
Skype("pandey.divyanshu34", getpass(), ".tokens-pandey.divyanshu34")
sk = Skype(connect=False)
print(sk.contacts) | 1.789063 | 2 |
21爬虫入门/day01/note.py | HaoZhang95/PythonAndMachineLearning | 937 | 12788244 | """
爬虫的用途:12306抢票,短信轰炸,数据获取
分类:通用爬虫:是搜索引擎抓取系统的重要部分,主要是把互联网上的页面下载到本地作为一个镜像备份
聚焦爬虫:对特定需求进行数据获取,会对页面的内容进行筛选,保证只抓取和需求相关的网页信息
Http:端口号80
Https: 端口号443
使用第三方的requests进行请求:支持python2和3,在urllib中2和3的语法有些不一样
"""
import requests
kw = {'wd': '长城'}
# headers伪装成一个浏览器进行的请求
# 不加这个的话,网页会识别出请求来自一个python而不是... | 3.34375 | 3 |
summarize.py | grajekf/wae-2018 | 0 | 12788245 | <gh_stars>0
#!/usr/bin/env python3
import argparse
import numpy as np
import pandas as pd
def args():
parser = argparse.ArgumentParser()
parser.add_argument('output', metavar="OUTPUT", help="Output file", type=str)
parser.add_argument('files', nargs="+", metavar="FILES", help="Files to summarize (extract ... | 3.21875 | 3 |
rasa/graph_components/converters/nlu_message_converter.py | praneethgb/rasa | 8 | 12788246 | <reponame>praneethgb/rasa
from __future__ import annotations
from typing import Dict, Text, Any, Optional, List
from rasa.core.channels.channel import UserMessage
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import Mo... | 2.28125 | 2 |
tronn/preprocess/variants.py | kundajelab/tronn | 5 | 12788247 | <gh_stars>1-10
# description code for working with variants
import os
import gzip
import logging
# basically generate two fasta files, and then
# run a version of setup_h5_dataset that takes in two fasta files
# to generate two one hot encoded sets
def generate_new_fasta(vcf_file, fasta_file, out_fasta_file, ref=T... | 2.515625 | 3 |
Python/Learning/Libraries/TerminalTables.py | prynix/learning-programming | 2 | 12788248 | <gh_stars>1-10
"""
Happy now?
"""
from terminaltables import AsciiTable, SingleTable
table_data_large = [
['', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
['8:00 - 8:45', 'Mathematics', 'PE', '', '', ''],
['8:55 - 9:40', 'History', 'Advisory', 'Business', 'French', 'Mathematics'],
['9:50 -... | 2.21875 | 2 |
songs-generator2.py | Antoniii/Generator-of-songs-without-neural-network-and-SMS | 0 | 12788249 | import markovify
# with open("esenin.txt", 'r', encoding='utf-8') as f0, \
# open("kish.txt", 'r', encoding='utf-8') as f1, \
# open("kino.txt", 'r', encoding='utf-8') as f2, \
# open("kukr.txt", 'r', encoding='utf-8') as f3, \
# open("dataset.txt", 'a', encoding='utf-8') as f:
# f.write(f0.read())
# ... | 2.984375 | 3 |
select.py | misterpah/ldtp_adapter | 0 | 12788250 | <gh_stars>0
def selectitem(windowTitle, object, value, handle=None):
log("{} :not implemented yet".format(sys._getframe().f_code.co_name))
options = pyacc.comboboxListOptions(reverse_ldtp_me(windowTitle),reverse_ldtp_me(object),handle)
# get position of the wanted item
for each in range(0,len(options)):... | 2.921875 | 3 |