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 |
|---|---|---|---|---|---|---|
experiments/2_Maze_Neutrality/experiment/stimuli_creation/stim_csv_iterator.py | BranPap/gender_ideology | 1 | 33500 | import json
import pandas as pd
import random
df = pd.read_csv("experiment\stimuli_creation\maze_lexemes.csv")
states = ["California","Alabama","Alaska","Arizona","Arkansas","Connecticut","Colorado","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Ma... | 3.03125 | 3 |
Choruslib/chorusio.py | kramundson/Chorus2 | 11 | 33501 | from pyfasta import Fasta
def writebed(probelist, outbedfile):
'''probe list format:
chr\tstart\tend
'''
outio = open(outbedfile, 'w')
for pbnow in probelist:
print(pbnow, file=outio)
outio.close()
def writefa(genomefile, bedfile, outfile):
fastafile = Fasta(genomefile... | 2.765625 | 3 |
p001.py | scottwillmoore/project-euler | 1 | 33502 | <reponame>scottwillmoore/project-euler
c = lambda n: n % 3 == 0 or n % 5 == 0
print(sum(filter(c, range(0, 1000))))
| 2.6875 | 3 |
source/Tutorials/Actions/client_0.py | dsauval/ros2_documentation | 291 | 33503 | import rclpy
from rclpy.action import ActionClient
from rclpy.node import Node
from action_tutorials_interfaces.action import Fibonacci
class FibonacciActionClient(Node):
def __init__(self):
super().__init__('fibonacci_action_client')
self._action_client = ActionClient(self, Fibonacci, 'fibonacc... | 2.609375 | 3 |
label_demo.py | encela95dus/ios_pythonista_examples | 36 | 33504 | <gh_stars>10-100
import ui
def make_label(text, font, alignment, background_color, x, y):
w, h = ui.measure_string(text,
font=font, alignment=alignment, max_width=0)
#print(w,h)
label = ui.Label(text=text,
font=font, alignment=alignment,
background_color=ba... | 2.5625 | 3 |
dev.py | wabscale/flasq | 1 | 33505 | from web import app
from glob import glob
app.run(
debug=True,
host='0.0.0.0',
port=5000,
extra_files=glob('./web/templates/**.html')
)
| 1.859375 | 2 |
src/django/addr/addr/settings.py | deshk04/addressparser | 0 | 33506 | """
Django settings for addr project.
Generated by 'django-admin startproject' using Django 1.11.29.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
f... | 1.84375 | 2 |
Hash PWs for Cisco/setupPW.py | NetworkNick-US/PythonScripts | 0 | 33507 | <reponame>NetworkNick-US/PythonScripts
import getpass
import os
import platform
import subprocess
class Style:
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
MAGENTA = '\033[35m'
CYAN = '\033[36m'
WHITE = '\033[37m'
UNDERLINE = '\033[4m... | 2.65625 | 3 |
web-scraping-challenge/scrape_mars.py | Felicia620/web-scraping-challenge | 0 | 33508 | from bs4 import BeautifulSoup
import requests
import pymongo
from splinter import Browser
from flask import Flask, render_template, redirect
from flask_pymongo import PyMongo
import pandas as pd
def init_browser():
executable_path = {"executable_path": "chromedriver"}
return Browser("chrome", **execu... | 2.859375 | 3 |
proyo/templates/create/python/{{package_name}}/__main__.py | MatthewScholefield/proyo | 0 | 33509 | <filename>proyo/templates/create/python/{{package_name}}/__main__.py
# ~ if project_type == 'script':
# ~ with proyo.config_as(var_regex=r'# ---(.*?)--- #'):
# ---gen_license_header('#')--- #
# ~ #
from argparse import ArgumentParser
def main():
parser = ArgumentParser(description='{{description or tagline or ""}... | 2.015625 | 2 |
get_sd_ou/databaseUtil.py | ErfanPY/siencedirect-authors-data | 0 | 33510 | <reponame>ErfanPY/siencedirect-authors-data
import logging
import mysql.connector
from get_sd_ou.config import Config
logger = logging.getLogger('mainLogger')
def init_db(host=None, user=None, password=None, port=None):
logger.debug('[databaseUtil][init_db][IN]')
cnx = mysql.connector.connect(
host ... | 2.265625 | 2 |
xxhh/rank.py | jannson/Similar | 2 | 33511 | <filename>xxhh/rank.py
import sys, os, os.path, re
import codecs
import numpy as np
from scipy.sparse import *
from scipy import *
from sklearn.externals import joblib
import networkx as nx
django_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(13, django_path)
os.environ['DJANGO_SETTINGS_MODULE'] = ... | 2.25 | 2 |
qcfractal/tests/test_server.py | MolSSI/dqm_server | 113 | 33512 | """
Tests the DQM Server class
"""
import json
import os
import threading
import pytest
import requests
import qcfractal.interface as ptl
from qcfractal import FractalServer, FractalSnowflake, FractalSnowflakeHandler
from qcfractal.testing import (
await_true,
find_open_port,
pristine_loop,
test_serv... | 2.25 | 2 |
WLED_WiFi/WLED_WiFi.py | nirkons/Prismatik-WLED-WiFi | 0 | 33513 | <reponame>nirkons/Prismatik-WLED-WiFi
import lightpack, socket, configparser, os
from time import sleep
import sys
class WLED_WiFi:
def __init__(self):
self.loadConfig()
self.lp = lightpack.Lightpack()
self.status = False
try:
self.lp.connect()
except lightpack.C... | 2.484375 | 2 |
learning_experiments/src3/eval_trained_model.py | TommasoBendinelli/spatial_relations_experiments | 0 | 33514 | import argparse
import os
import os.path as osp
import cv2
import numpy as np
from scipy.stats import multivariate_normal
from scipy.stats import norm
import matplotlib
# matplotlib.use('agg')
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import subprocess
import shutil
import chainer
from ch... | 2.09375 | 2 |
temp/pattern.py | BlueBeret/ComputerGraphics-Assignment | 1 | 33515 | <gh_stars>1-10
from tkinter import *
root = Tk()
canvas = Canvas(root,
width=1000,
height=1000,
background="#FFFFFF")
canvas.pack(expand=YES, fill=BOTH)
def dot(x,y,size=1, color="#FF0000", outline=""):
if size==1:
canvas.create_line(x,y,x+1,y, fill=color, width=size)
return
ca... | 2.9375 | 3 |
AKextensions.py | bmilosh/Common-Information-and-Matroid-Ports | 1 | 33516 | from gurobipy import *
from itertools import combinations
from time import localtime, strftime, time
import config
from fibonew2 import (
AK2exp, InitMatNew, MatroidCompatible, Resol2m, bi, bs, disjoint, rankfinder,
ib, sb)
from timing import endlog, log
def CheckOneAK(mbases,gset,rnk):
'''
We check ... | 2.359375 | 2 |
Multiobjective Optimization/Compass.py | joymallyac/Fairway | 6 | 33517 | <gh_stars>1-10
import pandas as pd
import numpy as np
import random,time
import math,copy
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
from sklearn.metrics import classification_report, confusion_matrix, accuracy_... | 2.125 | 2 |
test_module.py | devsysenv/tests | 0 | 33518 | #!/usr/bin/env python
import pytest
import os
import sys
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
from pathlib import Path
from dselib.thread import initTLS
initTLS()
from constants import CONST
from dselib.path import normalizePath
from dselib.dir impo... | 2.078125 | 2 |
pilemma/env/pilemma_env.py | cmackeen/pilemma | 0 | 33519 | <filename>pilemma/env/pilemma_env.py
import gym
from gym import error, spaces, utils
from gym.utils import seeding
import numpy as np
import pandas as pd
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from pilemma.env.dai_auct import Urn
import glob
import os
import random
init_dai=10... | 2.59375 | 3 |
String/P151 - reverseWordsInString.py | HarshOza36/LeetCode_Problems | 0 | 33520 | class Solution:
def reverseWords(self, s: str) -> str:
s = s.split(" ")
s = [i for i in s if i != ""]
return " ".join(s[::-1]) | 3.625 | 4 |
kaggle-santa-2015/submission.py | gabormakrai/kaggle-santa-2015 | 0 | 33521 | from haversine import haversine
def loadOrder(fileName):
print("Loading order from " + fileName + "...")
order = []
# open the file
with open(fileName) as infile:
# read line by line
for line in infile:
# remove newline character from the end... | 3.09375 | 3 |
healthkit_to_sqlite/utils.py | cwkendall/healthkit-to-sqlite | 0 | 33522 | from xml.etree import ElementTree as ET
import io
import os.path
import sys
import gpxpy
import builtins
def find_all_tags(fp, tags, progress_callback=None):
parser = ET.XMLPullParser(("start", "end"))
root = None
while True:
chunk = fp.read(1024 * 1024)
if not chunk:
break
... | 2.578125 | 3 |
tests/utils/test_kronecker.py | gtpash/rom-operator-inference-Python3 | 0 | 33523 | # utils/test_kronecker.py
"""Tests for rom_operator_inference.utils._kronecker."""
import pytest
import numpy as np
import rom_operator_inference as opinf
# Index generation for fast self-product kronecker evaluation =================
def test_kron2c_indices(n_tests=100):
"""Test utils._kronecker.kron2c_indices... | 2.0625 | 2 |
gadann/updater.py | dpineo/gadann | 0 | 33524 | #
# GADANN - GPU Accelerated Deep Artificial Neural Network
#
# Copyright (C) 2014 <NAME> (<EMAIL>)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including w... | 2.078125 | 2 |
Aula37/View/testesquad.py | PabloSchumacher/TrabalhosPython | 0 | 33525 | <reponame>PabloSchumacher/TrabalhosPython
import sys
sys.path.append( r"C:\Users\900157\Documents\Github\TrabalhosPython\Aula37" )
from Controller.squad_controller import SquadController
from Model.squad import Squad
squad = Squad()
squad.nome = 'JooJ'
squad.descricao = 'Intermediário'
squad.npessoas = 20
squad.backen... | 2.25 | 2 |
restapi/resources/login.py | fossabot/http-api | 0 | 33526 | <filename>restapi/resources/login.py
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import pytz
from restapi.rest.definition import EndpointResource
from restapi.exceptions import RestApiException
from restapi.connectors.authentication import HandleSecurity
from restapi import decorators
from restap... | 2.625 | 3 |
bot.py | egor5q/casino | 0 | 33527 | # -*- coding: utf-8 -*-
import redis
import os
import telebot
import math
import random
import threading
from telebot import types
from emoji import emojize
from pymongo import MongoClient
token = os.environ['TELEGRAM_TOKEN']
bot = telebot.TeleBot(token)
admins=[441399484]
games={}
client1=os.environ['database']
clie... | 2.296875 | 2 |
qrogue/game/logic/collectibles/collectible.py | 7Magic7Mike7/Qrogue | 4 | 33528 | <filename>qrogue/game/logic/collectibles/collectible.py
import math
from abc import ABC, abstractmethod
from enum import Enum
from typing import Iterator
class CollectibleType(Enum):
Consumable = 1
Gate = 2
ActiveItem = 3
PassiveItem = 4
Pickup = 5
Qubit = 6
Multi = 0 # wraps multiple c... | 3.4375 | 3 |
flux/resources/workflow.py | siq/flux | 0 | 33529 | <filename>flux/resources/workflow.py
from mesh.standard import *
from scheme import *
__all__ = ('Workflow',)
Layout = Sequence(Structure({
'title': Text(),
'view': Token(),
'elements': Sequence(Structure({
'type': Token(nonempty=True),
'field': Token(nonempty=True),
'label': Text(... | 1.96875 | 2 |
Most Asked DSA By Companies/Meta/3-973.py | neelaadityakumar/leetcode | 0 | 33530 | <gh_stars>0
# https://leetcode.com/problems/k-closest-points-to-origin/
# 973. K Closest Points to Origin
# Medium
# Share
# Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0).
# The distance between two points on t... | 3.53125 | 4 |
src/huaytools/pytorch/modules/loss/cosine_similarity.py | imhuay/studies-gitbook | 100 | 33531 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Time: 2021-10-13 8:30 下午
Author: huayang
Subject:
"""
import os
import sys
import json
import doctest
from typing import *
from collections import defaultdict
from torch.nn import functional as F # noqa
from huaytools.pytorch.modules.loss.mean_squared_error import... | 2.765625 | 3 |
Tree/98. 验证二叉搜索树.py | graveszhang/LeetCode-Practice | 0 | 33532 | <reponame>graveszhang/LeetCode-Practice
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# if root.left and root.right:
# if v <= root.left.val or v >= root... | 3.734375 | 4 |
scNLP_spaCy_GeneExpression_word2vec.py | alexcwsmith/scNLP | 1 | 33533 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 1 12:48:08 2020
@author: smith
"""
import spacy
from gensim.test.utils import common_texts, get_tmpfile
from gensim.models import Word2Vec
from gensim.models.phrases import Phrases, Phraser
import os
import multiprocessing
import csv
import re
impo... | 2.125 | 2 |
cvp/setup.py | hashnfv/hashnfv-dovetail | 1 | 33534 | import setuptools
__author__ = 'serena'
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr==2.0.0'],
pbr=True)
| 1.28125 | 1 |
data_utils/preprocess.py | AnastasiiaNovikova/sentiment-discovery | 0 | 33535 | import os
import re
import html
import unidecode
import torch
HTML_CLEANER_REGEX = re.compile('<.*?>')
def clean_html(text):
"""remove html div tags"""
return re.sub(HTML_CLEANER_REGEX, ' ', text)
def binarize_labels(labels, hard=True):
"""If hard, binarizes labels to values of 0 & 1. If soft thresholds... | 2.90625 | 3 |
Python/_10_09/2.3.19.py | MBkkt/Homework | 1 | 33536 | """ Комбинации. Составьте программу combinations. ру, получающую из командной
строки один аргумент n и выводящую все 2" комбинаций любого
размера. Комбинация - это подмножество из п элементов, независимо
от порядка. Например, когда п = 3, вы должны получить следующий вывод:
а аЬ аЬс ас Ь ьс с
Обратите внимание, чт... | 3.828125 | 4 |
KerasTest_XOR.py | RaduGrig/DeepLearning | 0 | 33537 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 16 22:19:57 2017
@author: RaduGrig
@inspiration: NikCleju
"""
# import stuff
from keras.optimizers import Adam
from keras.models import Sequential
from keras.layers import Dense, Activation
import numpy as np
import matplotlib.pyplot as plot
#Params
DataPoi... | 2.96875 | 3 |
lib/opentok/__init__.py | Rudi9719/booksearch-web | 0 | 33538 | <gh_stars>0
from .opentok import OpenTok, Roles, MediaModes, ArchiveModes
from .session import Session
from .archives import Archive, ArchiveList, OutputModes
from .exceptions import OpenTokException
from .version import __version__
| 1.09375 | 1 |
src/rubrik_config/rubrik_config_base.py | rubrikinc/rubrik-config-backup | 2 | 33539 | <gh_stars>1-10
import abc
import json
import os
from rubrik_config import helpers
class RubrikConfigBase(abc.ABC):
def __init__(self, path, rubrik, logger):
self.path = path
self.rubrik = rubrik
self.logger = logger
self.cluster_version = self.rubrik.cluster_version()
se... | 2.5 | 2 |
Gather_Data.py | batumoglu/Home_Credit | 1 | 33540 | <filename>Gather_Data.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 28 19:51:12 2018
@author: ozkan
"""
import pandas as pd
import numpy as np
#from sklearn.preprocessing import MinMaxScaler, LabelEncoder
from scipy import stats
import gc
import GatherTables
def one_hot_encod... | 2.140625 | 2 |
ois/data_request.py | pandincus/ois-service | 3 | 33541 | from .data_request_type import DataRequestType
class DataRequest():
def __init__(self, fieldName, requestType):
self.fieldName = fieldName
self.requestType = requestType
self.value = 0
| 2.5 | 2 |
doc/source/conf.py | OpenTreeOfLife/nexson | 0 | 33542 | # -*- coding: utf-8 -*-
"""
Sphinx configuration for nexson.
Largely based on <NAME>'s conf.py in DendroPy.
"""
import sys
import os
import time
from sphinx.ext import autodoc
from nexson import __version__ as PROJECT_VERSION
# -- Sphinx Hackery ------------------------------------------------
# Following allows f... | 2.296875 | 2 |
prev_ob_models/exclude/GilraBhalla2015/synapses/mitral_granule_NMDA.py | fameshpatel/olfactorybulb | 0 | 33543 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import math
# The PYTHONPATH should contain the location of moose.py and _moose.so
# files. Putting ".." with the assumption that moose.py and _moose.so
# has been generated in ${MOOSE_SOURCE_DIRECTORY}/pymoose/ (as default
# pymoose build does) and this file i... | 2.21875 | 2 |
marltoolbox/experiments/rllib_api/amtft_various_env.py | longtermrisk/marltoolbox | 17 | 33544 | <reponame>longtermrisk/marltoolbox
import copy
import logging
import os
import ray
from ray import tune
from ray.rllib.agents import dqn
from ray.rllib.agents.dqn.dqn_torch_policy import postprocess_nstep_and_prio
from ray.rllib.utils import merge_dicts
from ray.rllib.utils.schedules import PiecewiseSchedule
from ray.... | 1.953125 | 2 |
src/core/utils/win32/media_control.py | younger-1/yasb | 53 | 33545 | from winrt.windows.media.control import GlobalSystemMediaTransportControlsSessionManager
from winrt.windows.storage.streams import DataReader, Buffer, InputStreamOptions
async def get_current_session():
"""
current_session.try_play_async()
current_session.try_pause_async()
current_session.try_toggle_p... | 2.21875 | 2 |
lawerWeb/settings.py | xia-deng/lawerWeb | 0 | 33546 | <filename>lawerWeb/settings.py
"""
Django settings for lawerWeb project.
Generated by 'django-admin startproject' using Django 2.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1... | 1.804688 | 2 |
kriging/__init__.py | solab-ntu/kriging | 0 | 33547 | from .kparam import Kparam
from .variogram import Variogram
from .utilities import predict
| 0.929688 | 1 |
hparams.py | SuzukiDaishi/AutoVC.pytorch | 25 | 33548 | <gh_stars>10-100
class hparams:
sample_rate = 16000
n_fft = 1024
#fft_bins = n_fft // 2 + 1
num_mels = 80
hop_length = 256
win_length = 1024
fmin = 90
fmax = 7600
min_level_db = -100
ref_level_db = 20
seq_len_factor = 64
bits = 12
seq_len = seq_len_factor * hop_... | 1.515625 | 2 |
custom_components/hdhomerun/__init__.py | Berserkir-Wolf/ha-hdhomerun | 4 | 33549 | <filename>custom_components/hdhomerun/__init__.py
"""The HDHomeRun component."""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant import config_entries
from homeassistant.const import CONF_PORT
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from .co... | 2.15625 | 2 |
expRT/BTS_Material.py | EJ-Chang/OSD-Study | 0 | 33550 | # Material
buttonType = ['Arrow button', 'Radio button', 'Switch button', 'Option']
requestLUT = [
{
'name' : 'Radio',
'on' : 'OSD_ImgFolder/radio_on.png',
'off' : 'OSD_ImgFolder/radio_off.png',
'default' : 'off',
'hint_path' : 'OSD_ImgFolder/L4 off.png',
'hint': 0
},
{
'nam... | 1.507813 | 2 |
URMC_CTSI_openbadge_analysis/Demo.py | VerolaX/Capstone-URMC | 1 | 33551 | <gh_stars>1-10
import Dynamic_Network_Graph_Exploration_py3 as dynamic
import Data_Cleaning as dc
#import heatmap_functions as heatmap
#import Member_Distribution as dist
'''
So far the main method only includes dynamic network graph functions
Heatmap_functions and Member_Distribution functions to be added ... | 2.296875 | 2 |
evap/rewards/tests.py | karyon/EvaP | 0 | 33552 | from django.conf import settings
from django_webtest import WebTest
from evap.evaluation.models import Course
from evap.evaluation.models import UserProfile
from evap.rewards.models import SemesterActivation
from evap.rewards.models import RewardPointRedemptionEvent
from evap.rewards.tools import reward_points_of_user
... | 2.0625 | 2 |
tests/test_seo_client.py | bedroesb/ddipy | 1 | 33553 | from unittest import TestCase
from ddipy.constants import MISSING_PARAMETER
from ddipy.ddi_utils import BadRequest
from ddipy.seo_client import SeoClient
class TestSeoClient(TestCase):
def test_seo_home(self):
client = SeoClient()
res = client.get_seo_home()
assert len(res.graph) > 0
... | 2.6875 | 3 |
construction/markdown.py | rik/mesconseilscovid | 0 | 33554 | import re
from textwrap import indent
import mistune
from jinja2 import Template
from .directives.injection import InjectionDirective
from .directives.renvoi import RenvoiDirective
from .directives.section import SectionDirective
from .directives.question import QuestionDirective
from .directives.toc import Directive... | 2.375 | 2 |
HMS/Hospital/models.py | Arshad360/Hospital-Management-System-Cse327-Projectr | 2 | 33555 | <gh_stars>1-10
from django.db import models
from django.contrib.auth.models import User
# Create your models here
# All the departments
departments = [('Cardiologist', 'Cardiologist'),
('Dermatologists', 'Dermatologists'),
('Emergency Medicine Specialists', 'Emergency Medicine Special... | 2.53125 | 3 |
intents/connectors/_experimental/snips/entities_test.py | dario-chiappetta/dialogflow_agents | 6 | 33556 | from datetime import datetime
import pytest
from intents import Sys
from intents.connectors._experimental.snips import entities
from intents.connectors._experimental.snips import prediction_format as pf
def test_date_mapping_from_service():
mapping = entities.DateMapping()
snips_date_result = {
'inpu... | 2.296875 | 2 |
src/tests/unit/common/test_common_management_commands.py | hnzlmnn/pretalx | 1 | 33557 | import pytest
from django.core.management import call_command
@pytest.mark.django_db
def test_common_runperiodic():
call_command('runperiodic')
| 1.65625 | 2 |
src/ui_elements/dropdown.py | MichalKacprzak99/WFIIS-3D-Graphics-2021 | 0 | 33558 | <filename>src/ui_elements/dropdown.py
from typing import List, Optional
import pygame
from OpenGL.GL import *
from src.utils.drawing_utils import draw_texture, surface_to_texture
class DropDown:
def __init__(self, color_menu, color_option, x: int, y: int, width: int, height: int,
font_name: str... | 2.921875 | 3 |
simulation/device/simulated/air_conditioner/__init__.py | LBNL-ETA/LPDM | 2 | 33559 | <filename>simulation/device/simulated/air_conditioner/__init__.py
from air_conditioner import AirConditioner
| 1.242188 | 1 |
Chapter_2/rock_paper_scissors_functions.py | MrRiahi/Practices-of-the-Python-Pro | 0 | 33560 | <reponame>MrRiahi/Practices-of-the-Python-Pro
import random
OPTIONS = ['rock', 'paper', 'scissors']
def print_options():
"""
This function prints game's options
:return:
"""
print('(1) Rock\n(2) Paper\n(3) Scissors')
def get_human_choice():
"""
This function gets the choice of the hum... | 4.40625 | 4 |
ndcontainers/utils/mixins.py | MattEding/Array-Containers | 0 | 33561 | <filename>ndcontainers/utils/mixins.py
import inspect
import itertools
__all__ = ['NDArrayReprMixin']
class NDArrayReprMixin:
def _name_params(self, ignore=()):
name = type(self).__name__
sig = inspect.signature(type(self))
params = tuple(p for p in sig.parameters if p not in ignore)
... | 2.390625 | 2 |
demo/python/horizon.py | ebraminio/astronomy-fork | 138 | 33562 | #!/usr/bin/env python3
#
# horizon.py - by <NAME> - 2019-12-18
#
# Example Python program for Astronomy Engine:
# https://github.com/cosinekitty/astronomy
#
# This is a more advanced example. It shows how to use coordinate
# transforms and a binary search to find the two azimuths where the
# eclipti... | 3.4375 | 3 |
ProtocolHandlerAddonPython/tools/step1settings.py | p--q/ProtocolHandlerAddonPython | 0 | 33563 | <reponame>p--q/ProtocolHandlerAddonPython
#!/opt/libreoffice5.2/program/python
# -*- coding: utf-8 -*-
# This name will be rdb file name, .components file name, oxt file name.
BASE_NAME = "ProtocolHandlerAddonPython" # これがrdbファイル名、.componentsファイル名、oxtファイル名になる。
# a list of a dict of Python UNO Component Files: (file ... | 2.34375 | 2 |
backup/socketbackend.py | bit0fun/plugins | 173 | 33564 | from collections import namedtuple
import json, logging, socket, re, struct, time
from typing import Tuple, Iterator
from urllib.parse import urlparse, parse_qs
from backend import Backend, Change
from protocol import PacketType, recvall, PKT_CHANGE_TYPES, change_from_packet, packet_from_change, send_packet, recv_pack... | 2.390625 | 2 |
src/aac_map.py | vlomonaco/crlmaze | 20 | 33565 | <reponame>vlomonaco/crlmaze
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2019. <NAME>, <NAME>, <NAME>, #
# <NAME>. All rights reserved. #
# See the accompanying LICENSE file for... | 2.0625 | 2 |
questions/8.py | xiaochus/LeetCode | 1 | 33566 | """8. String to Integer (atoi)
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a
challenge, please do not see below and ask yourself what are the
possible input cases.
Notes: It is intended for this problem to be specified vaguely
(ie, no given input sp... | 3.671875 | 4 |
models/dbconfig.py | FusionX9000/Reddit-Saves-Manager | 0 | 33567 | <reponame>FusionX9000/Reddit-Saves-Manager
database = "database"
user = "postgres"
password = "password"
host = "localhost"
port = "5432"
| 0.949219 | 1 |
Programs/HowToUse.py | aposum23/laborathory14 | 0 | 33568 | <gh_stars>0
def mul(a, b):
return a * b
mul(3, 4)
#12
def mul5(a):
return mul(5,a)
mul5(2)
#10
def mul(a):
def helper(b):
return a * b
return helper
mul(5)(2)
#10
def fun1(a):
x = a * 3
def fun2(b):
nonlocal x
return b + x
return fun2
test_fun = fun1(4)
test_f... | 3.015625 | 3 |
py_tdlib/constructors/set_bot_updates_status.py | Mr-TelegramBot/python-tdlib | 24 | 33569 | from ..factory import Method
class setBotUpdatesStatus(Method):
pending_update_count = None # type: "int32"
error_message = None # type: "string"
| 1.820313 | 2 |
Chapter 9/code1.py | PacktPublishing/Mastering-IPython-4 | 22 | 33570 | <reponame>PacktPublishing/Mastering-IPython-4<filename>Chapter 9/code1.py
"""
This is an abbreviated version of my random number generator test suite.
It uses the pytest framework. It does not do much in this form.
"""
import numpy as np
import scipy.stats
import random
class TestRandoms( ):
"""
This is the... | 2.84375 | 3 |
tests/test.py | J35P312/vcf2cytosure | 1 | 33571 | <reponame>J35P312/vcf2cytosure
import pytest
from unittest.mock import patch
import vcf2cytosure
def test_version_argument():
with patch('sys.argv', ['vcf2cytosure.py','--version']):
with pytest.raises(SystemExit) as excinfo:
vcf2cytosure.main()
assert excinfo.value.code == 0
| 2.140625 | 2 |
playback/db.py | Nierot/Spotify | 0 | 33572 | <gh_stars>0
from . import models
def new_user(name, date, token):
existing_users = models.User.objects.filter(token=token)
if (len(models.User.objects.filter(token=token)) > 0):
return False
else:
user = models.User(name=name,created_at=date,token=token)
user.save()
return T... | 2.5 | 2 |
invenio_records_rest/loaders/__init__.py | NRodriguezcuellar/invenio-records-rest | 5 | 33573 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Loaders for deserializing records in the REST API."""
from ..schemas import Recor... | 1.617188 | 2 |
tests/test_csvtodb.py | rv816/csvtodb | 0 | 33574 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_csvtodb
----------------------------------
Tests for `csvtodb` module.
"""
import unittest
from csvtodb.csvtodb import *
class TestCsvtodb(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_000_somethin... | 3.046875 | 3 |
config.py | mscienski/code-challenge-starter-python-flask | 0 | 33575 | <filename>config.py
#pylint: disable=no-member
import os
import logging
from flask import Flask
from flask_cors import CORS
from sqlalchemy.orm import sessionmaker
from flask_sqlalchemy import SQLAlchemy
host: str = os.getenv('DB_HOST', 'localhost')
port: int = int(os.getenv('DB_PORT', '5432'))
user: str = os.getenv('... | 2.0625 | 2 |
shared-data/python/tests/labware/__init__.py | Opentrons/protocol_framework | 2 | 33576 | from typing import List, Tuple
from pathlib import Path
def get_ot_defs() -> List[Tuple[str, int]]:
def_files = (
Path(__file__).parent / ".." / ".." / ".." / "labware" / "definitions" / "2"
).glob("**/*.json")
# example filename
# shared-data/labware/definitions/2/opentrons_96_tiprack_300ul... | 2.609375 | 3 |
scripts/migrate_unconfirmed_valid_users.py | fabmiz/osf.io | 1 | 33577 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to migrate users with a valid date_last_login but no date_confirmed."""
import sys
import logging
from django.utils import timezone
from website.app import init_app
from website.models import User
from scripts import utils as script_utils
from te... | 2.296875 | 2 |
src/main/python/proc/expression/let.py | cjblink1/lang | 0 | 33578 | <reponame>cjblink1/lang
from proc.expression.expression import Expression
from proc.environment import Environment
class LetExpression(Expression):
def __init__(self, variable: str, bound_expression: Expression, body: Expression):
self.variable = variable
self.bound_expression = bound_expression
... | 2.765625 | 3 |
cah/__init__.py | pordino/aikaterna-cogs | 98 | 33579 | <gh_stars>10-100
from .cah import CardsAgainstHumanity
__red_end_user_data_statement__ = "This cog does not persistently store data or metadata about users."
def setup(bot):
bot.add_cog(CardsAgainstHumanity(bot))
| 1.882813 | 2 |
apps/civic_pulse/management/commands/create_scraper_user.py | JimHafner/GovLens | 17 | 33580 | <reponame>JimHafner/GovLens
"""Idempotent management command to create the scraper user with a DRF token
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
SCRAPER_USERNAME = "scraper"
class Command(BaseCommand):
h... | 2.65625 | 3 |
Simulation/reaching_gym/render.py | wq13552463699/UCD_UR5E | 5 | 33581 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 23:19:58 2021
@author: qiang
"""
import tensorflow.keras.backend as K
import tensorflow as tf
import time
from rl_symbol_env_continous import symbol_env_continous
from DDPG_keras import ActorCritic
from env_base import UR5_env
obs_dim = (10,)
... | 2.28125 | 2 |
battingOrbowling_comp.py | ThomasAitken/Cricket-Modelling-Project | 0 | 33582 | <gh_stars>0
#how to get a measure of batting or bowling strength? why it's simple! take top-100 rankings list at given period...
#what is score held by #1 player? normalise against this score (i.e. this score now equivalent to 1)
#now add up top 8 normalised scores for each nation's top 8 players in top 100 (set x: 0 ... | 3.3125 | 3 |
Python-Programming/apply_functions_to_args.py | clickok/Code-Snippets | 0 | 33583 | #!/usr/bin/python3
""" Applies a list of functions to command line arguments.
For quick-and-dirty command line argument handling.
"""
import sys
# List of functions to apply
funcLst = [int, int, float, float, int, int, int]
def parseArgs(argLst):
for i in range(len(argLst)):
print(funcLst[i](argLst[i]))
def... | 3.765625 | 4 |
slot_filling/corpus_server_direct.py | IBM/kgi-slot-filling | 21 | 33584 | #!/usr/bin/env python
# encoding: utf-8
from flask import Flask, request, jsonify
import base64
import numpy as np
from util.args_help import fill_from_args
import os
import logging
from dpr.simple_mmap_dataset import Corpus
from dpr.faiss_index import ANNIndex
logger = logging.getLogger(__name__)
class Options():
... | 2.03125 | 2 |
b2btool/rename/rename_to_jde.py | recs12/b2btool | 0 | 33585 | import os
import shutil
import pandas as pd
from pathlib import Path
from b2btool.blob.storage import *
try:
conversion = pd.read_excel(
r"J:\PTCR\Users\RECS\.b2btool\drawings_to_jde.xlsx",
dtype={"ID": str, "JDE": str},
)
except FileNotFoundError as ex:
print(ex.args)
def find_jde(draw... | 2.953125 | 3 |
nlp/extract/util/nlp_process.py | anndawn/ccij-water-search | 0 | 33586 | import spacy
import pandas as pd
import numpy as np
# Given tokens, find sentences containing a keyword from texts
def find_sents(tokens,keyword):
useful_sents=[]
for sent in tokens.sents:
bows=[token.text for token in sent]
for word in bows:
if ((keyword in word.lower()) & (sent n... | 3.03125 | 3 |
recipes/onedpl/all/conanfile.py | dvirtz/conan-center-index | 562 | 33587 | <gh_stars>100-1000
import os
from conans import ConanFile, CMake, tools
required_conan_version = ">=1.28.0"
class OneDplConan(ConanFile):
name = "onedpl"
description = ("OneDPL (Formerly Parallel STL) is an implementation of "
"the C++ standard library algorithms"
"with ... | 2.015625 | 2 |
atvpolimorfismo.py | Patricia-Silva1/atividade | 0 | 33588 | class Atletas:
def _init_(self,nome,idade,pontuacao):
self.nome = nome
self.idade = idade
self.pontuacao = pontuacao
class Amador(Atletas):
def _init_(self, nome, idade, pontuacao):
super()._init_(nome, idade, pontuacao)
self.amador = True
self.profissional = Fa... | 3.71875 | 4 |
grouper/ctl/base.py | aneeq009/merou | 58 | 33589 | from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
class CtlCommand(metaclass=ABCMeta):
"""Implements a subcommand of grouper-ctl."""
@staticmethod
@abstractmethod
def add_arguments(parser):
# type: (A... | 3.234375 | 3 |
noysim/geo.py | bertdecoensel/noysim | 1 | 33590 | # Noysim -- Noise simulation tools for Aimsun.
# Copyright (c) 2010-2011 by <NAME>, Ghent University & Griffith University.
#
# Basic geometry functions and classes
import numpy
import pylab
EPSILON = 10e-12 # smallest difference for points/directions
#--------------------------------------------------... | 3.140625 | 3 |
aa.py | ani37/Hello-world | 0 | 33591 | <reponame>ani37/Hello-world
MAX = 100000
MOD = pwo(10, 9) + 7
dp = [1 for in xrange(MAX)]
for i in xrange(7, MAX):
dp[i] = (dp[i - 1] + dp[i - 7]) % MOD
n = input()
for i in xrange(n):
k = input()
print dp[k]
| 2.6875 | 3 |
pyrometheus/codegen/python.py | pyrometheus/pyrometheus | 7 | 33592 | <reponame>pyrometheus/pyrometheus
"""
Python code generation
----------------------
.. autofunction:: gen_thermochem_code
.. autofunction:: get_thermochem_class
"""
__copyright__ = """
Copyright (C) 2020 <NAME>
Copyright (C) 2020 <NAME>
"""
__license__ = """
Permission is hereby granted, free of charge, to any per... | 1.625 | 2 |
foxwall_api/urls.py | umtdemr/foxwall | 0 | 33593 | <filename>foxwall_api/urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularRedocView,
SpectacularSwaggerView
)
urlpatterns = [
path(... | 2 | 2 |
python/dash_tools/staticdownloader.py | jainsat/media-tools | 1 | 33594 | <reponame>jainsat/media-tools<filename>python/dash_tools/staticdownloader.py
#!/usr/bin/env python
import os
from common import fetch_file
import staticmpdparser
import client
import json
import pdb
def download(options, mpd_url=None, mpd_str=None, base_url=None, base_dst=""):
"Download MPD if url specified and th... | 2.3125 | 2 |
Python/Delta/Delta.py | jankupczyk/Proste-Programy-PY | 1 | 33595 | # Oblicza delte
a = int(input("Podaj [a]:"))
b = int(input("Podaj [b]:"))
c = int(input("Podaj [c]:"))
d = b**2-4*a*c
if d > 0:
print("2 rozwiązania")
elif d == 0:
print("1 rozwiązanie")
else:
print("0 rozwiązań")
for i in range():
if i != 0:
print(i, end=" ")
| 3.484375 | 3 |
mealie/db/mongo/user_models.py | stevenroh/mealie | 0 | 33596 | <reponame>stevenroh/mealie<filename>mealie/db/mongo/user_models.py
# import mongoengine
# class User(mongoengine.Document):
# username: mongoengine.EmailField()
# password: mongoengine.ReferenceField | 1.695313 | 2 |
common/xrd-ui-tests-python/tests/xroad_global_groups_tests/XroadMemberRemoveFromGlobalGroup.py | nordic-institute/X-Road-tests | 1 | 33597 | import unittest
from helpers import auditchecker, xroad
from main.maincontroller import MainController
from tests.xroad_global_groups_tests import global_groups_tests
class XroadMemberRemoveFromGlobalGroup(unittest.TestCase):
"""
SERVICE_38 Remove an X-Road Member from a Global Group
RIA URL: https://jir... | 2.3125 | 2 |
python/GafferTest/ExtensionAlgoTest.py | ddesmond/gaffer | 561 | 33598 | ##########################################################################
#
# Copyright (c) 2019, <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source ... | 1.351563 | 1 |
sentimental_analysis.py | akrakman/hackillinois | 0 | 33599 | from numpy import average, number
from textblob import TextBlob
class ScaleUtilities:
average = 0
number = 0
def __init__(self, string, number):
self.string = string
def get_subjectivity_of(string):
polarity = TextBlob(string).sentiment.polarity * 5
number += 1
average... | 3.046875 | 3 |