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 |
|---|---|---|---|---|---|---|
pythonLoops.py | SandraCoburn/python-code-challenges | 0 | 45000 | <reponame>SandraCoburn/python-code-challenges<filename>pythonLoops.py
'''
We can use two types of loops in Python, a for loop and a while loop. A for loop iterates over a given sequence(iterator expression)
A while loop repeats as long as a boolean context evaluates to True.
the break statement terminates the loop con... | 4.375 | 4 |
exercices/003.py | haxuyennt38/python-learning | 0 | 45001 | <gh_stars>0
yearOfbirthday = int(input())
year = 2017
age = year - yearOfbirthday
print (f'In 2017, i am {age} years old') | 3.53125 | 4 |
hashdist/formats/templated_stream.py | krafczyk/hashdist | 67 | 45002 | """
A simple stream constructor that constructs a Stream by evaluating
parameter substitutions from a dictionary parameters. Finds tokens of the form
\{\{([a-zA-Z_-][\w-]*)\}\}
and replaces {{var}} with the contents of gettattr(parameters, var) in
the new stream.
"""
import re
from StringIO import StringIO
class Te... | 3.40625 | 3 |
swd/tools/leave.py | rrgodhorus/swd_django | 0 | 45003 | <reponame>rrgodhorus/swd_django<filename>swd/tools/leave.py
from .dev_info import leaves
def index(request):
from django.contrib.auth.models import User
from main.models import Warden, Leave, Student
from django.http import HttpResponse
import datetime
from django.utils.timezone import make_aware
... | 2.40625 | 2 |
files/recursion/recursion_examples-master/mergeSort2.py | multitudes/Python_am_Freitag | 0 | 45004 | def mergeSort(elements):
if len(elements) == 0 or len(elements) == 1:
# BASE CASE
return elements
middle = len(elements) // 2
left = mergeSort(elements[:middle])
right = mergeSort(elements[middle:])
if left == [] or right == []:
return left or right
result = []
i, ... | 4.15625 | 4 |
tests/Forum-app-api/run_client.py | MacHu-GWU/flask-restless-api-client-project | 0 | 45005 | <reponame>MacHu-GWU/flask-restless-api-client-project<filename>tests/Forum-app-api/run_client.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from flaskrestlessapiclient import Resource
from pprint import pprint as ppt
import json
url = "http://127.0.0.1:5000/api/"
us... | 2.53125 | 3 |
rl_agent/scripts/agents/test/gym_ddpg_server.py | alejodosr/drl-landing-iros | 8 | 45006 | <gh_stars>1-10
import filter_env
import rospy
from rl_agent_environment_communication.srv import *
import cv2
from cv_bridge import CvBridge
import gym
import numpy as np
ENV_NAME = 'LunarLanderContinuous-v2'
#ENV_NAME = 'Pendulum-v0'
DEBUG_SERVICES_MODE = False
env = filter_env.makeFilteredEnv(gym.make(ENV_NAME))
#... | 2.265625 | 2 |
game/characters/enemy.py | FilippoLeone/pypega | 4 | 45007 | import pyxel
import constants as c
import random
class Gachi:
def __init__(self, x, y):
self.x = x
self.y = y
self.x_side = [-16, 16, 16, 16, 16, 16]
self.y_side = [16, -16, 16, 16, 16, 16, 16, 16, 16, 16]
self.hp = c.gachi_hp
def draw(self):
pyxel.blt(self... | 2.6875 | 3 |
oulukneeloc/proposals.py | kuhlaid/KneeLocalizer | 4 | 45008 | import numpy as np
import pydicom as dicom
def read_dicom(filename):
"""Read DICOM file and convert it to a decent quality uint8 image.
Parameters
----------
filename: str
Existing DICOM file filename.
"""
try:
data = dicom.read_file(filename)
img = np.frombuffer(data.... | 3 | 3 |
Exerc_Python/desafio21a.py | BotoniLucas/Curso_Python | 0 | 45009 | # desafio 21
import pygame
pygame.mixer.init()
pygame.mixer.music.load('Deutschland.mp3')
pygame.mixer.music.play()
while (pygame.mixer.music.get_busy()): pass | 2.15625 | 2 |
tou.py | PhilRW/appdaemon-apps | 5 | 45010 | import datetime
import appdaemon.plugins.hass.hassapi as hass
import calendar
SHOULDER_START_HOUR = 13
PEAK_START_HOUR = 15
PEAK_END_HOUR = 19
# SHOULDER_END_HOUR = 21
SUMMER_MONTHS = [6, 7, 8, 9]
ON_PEAK = 'on-peak'
SHOULDER = 'shoulder'
OFF_PEAK = 'off-peak'
# PCCA = 0.00401
# DSMCA = 0.00159
# TCA = 0.00203
# CA... | 2.859375 | 3 |
main.py | 4dcu-be/WinstonCubeSim | 0 | 45011 | <reponame>4dcu-be/WinstonCubeSim<filename>main.py<gh_stars>0
from cubedata import RichCubeData as CubeData
import click
@click.command()
@click.option("--url", is_flag=True)
@click.argument("path", required=True, type=str)
def run(path, url):
cube_data = CubeData(draft_size=90)
if url:
cube_data.read_... | 2.421875 | 2 |
scripts/load_raw_data_into_db.py | netoferraz/acordaos-tcu | 21 | 45012 | <gh_stars>10-100
from scripts.funcs import initiate_db, load_csv_into_db, load_json_into_db
conn, cur = initiate_db("./db/acordaos-download.db")
#years = list(range(1992, 2000))
filename = "./data/api/raw/2018_2019.json"
load_json_into_db(filename, cursor=cur)
#load_csv_into_db(years, cur)
conn.commit()
conn.close()
| 2.21875 | 2 |
tetris/tetrominos/i.py | JacobChen258/AI-Constraints-Satisfaction | 0 | 45013 | <gh_stars>0
from .tetromino import Tetromino
class I(Tetromino):
def __init__(self):
super().__init__("I")
def _build(self):
self._original = [[0, 0, 0, 0],
[0, 0, 0, 0],
[6, 6, 6, 6],
[0, 0, 0, 0]]
| 2.3125 | 2 |
RTplzrunBlog/BruteForce/10819.py | lkc263/Algorithm_Study_Python | 0 | 45014 | import sys
from itertools import permutations
read = sys.stdin.readline
n = int(read())
arr = list(map(int, read().split()))
# 순열로 조합한다.
cases = list(permutations(arr))
result = 0
for card in cases:
ans = 0
for idx in range(n - 1):
ans += abs(card[idx] - card[idx + 1])
result = max(result, ans... | 2.71875 | 3 |
upy/contrib/customadmin/models.py | 20tab/upy | 2 | 45015 | """
It contains customadmin's models. It's used to customize admin's interface
"""
from upy.contrib.tree.models import _
from django.db import models
from upy.contrib.colors.fields import ColorField
from upy.contrib.sortable.models import PositionModel
from django.conf import settings
from imagekit.models import ImageS... | 2.3125 | 2 |
tools/hippydebug.py | jweinraub/hippyvm | 289 | 45016 | #!/usr/bin/env python
"""Hippy debugger.
Usage: hippydebug.py [debugger_options] ../hippy-c args...
(There are no debugger_options so far.)
"""
import sys, os, signal
import getopt
import subprocess
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from hippy.debugger import Connection,... | 2.40625 | 2 |
pygeonet_prepare.py | uva-hydroinformatics/wetland_identification | 2 | 45017 | #! /usr/bin/env python
import os
import shutil
import sys
import gdal
import wetland_id_defaults as default
"""
Folder structure for pyGeoNet is as follows
geoNetHomeDir : defines where files will be written
e.g.
geoNetHomeDir = "C:\\Mystuff\\IO_Data\\"
--- \\data (input lidar files will be rea... | 2.6875 | 3 |
brewerslab-orig-master/pitmButtonv2.py | allena29/brewerslabng | 1 | 45018 | <reponame>allena29/brewerslabng
#!/usr/bin/python
import os
import sys
import threading
import time
from pitmMcastOperations import pitmMcast
from pitmLogHandler import pitmLogHandler
from gpiotools2 import gpiotools2
from pitmCfg import pitmCfg
class pitmButton:
"""
pitmButton manages the toggling of mode... | 2.4375 | 2 |
yelp/obj/region.py | ruchir594/messenger-bot-yelp-aws | 8 | 45019 | # -*- coding: UTF-8 -*-
from yelp.obj.coordinate import Coordinate
from yelp.obj.response_object import ResponseObject
from yelp.obj.span import Span
class Region(ResponseObject):
def __init__(self, response):
super(Region, self).__init__(response)
self._parse('center', Coordinate, response)
... | 2.328125 | 2 |
muddery/mappings/event_action_set.py | noahzaozao/muddery | 0 | 45020 | <filename>muddery/mappings/event_action_set.py
"""
All available event actions.
"""
from __future__ import print_function
from django.conf import settings
from evennia.utils import logger
from muddery.utils.exception import MudderyError
from muddery.utils.utils import classes_in_path
from muddery.events.base_event_ac... | 2.171875 | 2 |
bcml4pheno/ttbarzp.py | sheride/bcml4pheno | 0 | 45021 | # AUTOGENERATED! DO NOT EDIT! File to edit: ttbarzp.ipynb (unless otherwise specified).
__all__ = ['get_elijah_ttbarzp_cs', 'get_manuel_ttbarzp_cs', 'import47Ddata', 'get47Dfeatures']
# Cell
import numpy as np
import tensorflow as tf
# Cell
def get_elijah_ttbarzp_cs():
r"""
Contains cross section information... | 2.0625 | 2 |
SensorMonitor/__init__.py | Nzbuu/SensorMonitor | 0 | 45022 | __author__ = '<NAME>'
__version__ = '0.0.2'
__all__ = [
'monitor', 'sensor', 'utils',
'time', 'w1therm'
]
| 0.941406 | 1 |
manila_tempest_tests/tests/api/admin/test_quotas.py | scality/manila | 1 | 45023 | <reponame>scality/manila
# Copyright 2014 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 1.671875 | 2 |
scanners/zap-advanced/scanner/zapclient/__main__.py | watchmen-coder/secureCodeBox | 1 | 45024 | # SPDX-FileCopyrightText: 2021 iteratec GmbH
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging
import sys
from zapv2 import ZAPv2
from .zap_automation import ZapAutomation
# set up logging to file - see previous section for more details
logging.basicConfig(
level=logging.INFO,
format='%... | 2.71875 | 3 |
flask_socketapi/exc.py | Teino1978-Corp/-Flask-SocketAPI | 6 | 45025 | <filename>flask_socketapi/exc.py<gh_stars>1-10
class SocketAPIError(Exception):
pass
class InvalidRequestError(SocketAPIError):
pass
class InvalidURIError(InvalidRequestError):
pass
class NotFoundError(InvalidRequestError):
pass
| 1.648438 | 2 |
aiohttp_admin2/controllers/types.py | Arfey/aiohttp_admin2 | 12 | 45026 | import typing as t
__all__ = ["Cell", "ListObject", ]
class Cell(t.NamedTuple):
"""Field data representation for html template"""
value: t.Any
url: t.Tuple[str, t.Dict[str, t.Union[str, int]]]
is_safe: bool = False
class ListObject(t.NamedTuple):
rows: t.List[t.List[Cell]]
has_next: bool
... | 2.609375 | 3 |
visualizer/visualizer.py | Jueast/VLAE_Pytorch | 0 | 45027 | <filename>visualizer/visualizer.py<gh_stars>0
from matplotlib import pyplot as plt
import os
import numpy as np
import scipy.misc as misc
from torchvision.utils import save_image
from torch.autograd import Variable
import torch
class Visualizer(object):
def __init__(self, savefolder, imgdim, args):
self.s... | 2.578125 | 3 |
manpy/simulation/CompoundObject.py | datarevenue-berlin/manpy | 3 | 45028 | # ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Founda... | 1.601563 | 2 |
ex7/ex7-1.py | ricek/lpthw | 0 | 45029 | # Prints out a string
print("Mary had a little lamb.")
# Prints out a formatted string
print("Its fleece was white as {}.".format('snow'))
# Prints out another string
print("and everywhere that Mary went.")
# Prints a period for ten times
print("." * 10) # what'd that do?
# Assign a letter to string variable
end1 = "... | 4.03125 | 4 |
sppas/sppas/src/ui/phoenix/page_files/refstreectrl.py | mirfan899/MTTS | 0 | 45030 | <reponame>mirfan899/MTTS
# -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | |... | 1.4375 | 1 |
examples/run_random.py | xiviu123/rlcard | 0 | 45031 | ''' An example of playing randomly in RLCard
'''
import argparse
import pprint
import rlcard
from rlcard.agents import RandomAgent
from rlcard.utils import set_seed
def run(args):
# Make environment
env = rlcard.make(args.env, config={'seed': 42})
# Seed numpy, torch, random
set_seed(42)
# Set a... | 2.796875 | 3 |
code/SVMExample.py | mahehu/SGN-41007 | 61 | 45032 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 11:01:16 2015
@author: hehu
"""
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.lda import LDA
from sklearn.svm import SVC, LinearSVC
from sklearn.linear_model import LogisticRegression
from sklearn.na... | 2.46875 | 2 |
abb_deeplearning_keras/Source_code/models/quiver_server.py | habichta/ETHZDeepReinforcementLearning | 7 | 45033 | <filename>abb_deeplearning_keras/Source_code/models/quiver_server.py<gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 14 12:31:13 2017
@author: maverick
"""
import keras
from keras.applications import vgg16
#model = vgg16.VGG16()
#
#from quiver_engine.server import lau... | 1.875 | 2 |
MusicObjectDetection/preprocessing/dataset_splitter.py | apacha/MusicObjectDetection | 2 | 45034 | import argparse
import os
import random
import pandas as pd
class DatasetSplitter:
""" Class that can be used to create a reproducible random-split of a dataset into train/validation/test sets """
def split_annotations_into_training_validation_and_test_set(self, dataset_directory: str,
... | 3.125 | 3 |
python/eu_class_user.py | IVFL-BOKU/landsupport | 0 | 45035 | <gh_stars>0
import argparse
import datetime
import itertools
import json
import logging
import os
import psycopg2
import re
import requests
import shutil
import subprocess
import sys
import traceback
parser = argparse.ArgumentParser()
parser.add_argument('--dbConf')
parser.add_argument('--rasdamanUrl', default='http:/... | 2 | 2 |
test/test_beacon_api.py | NCATS-Tangerine/tkbeacon-python-client | 0 | 45036 | # coding: utf-8
"""
Translator Knowledge Beacon API
This is the Translator Knowledge Beacon web service application programming interface (API). # noqa: E501
The version of the OpenAPI document: 1.3.0
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import abs... | 2.078125 | 2 |
Executor/GraphExecutionType.py | keshenjey/Heft | 3 | 45037 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import Graph
class GraphExecutionType(object):
def __init__(self):
# @AttributeType GraphExecutionType
self.___pATH = None
# @AttributeType GraphExecutionType
self.___cLUSTER = None
# @AttributeType GraphExecutionType
self.___rANK = None
| 1.882813 | 2 |
Experiment2/Photoeffect_Plank/Photoeffect_Plank.py | wzk1015/PhysicsExperiment | 2 | 45038 | <filename>Experiment2/Photoeffect_Plank/Photoeffect_Plank.py
# 光电效应测定普朗克常数
import xlrd
import os, sys, shutil
from numpy import array, asarray, abs
sys.path.append("../..")
from GeneralMethod.PyCalcLib import Method, Fitting
from GeneralMethod.Report import Report
class Photoeffect_Plank :
PREVIEW_FILENAME = "Pre... | 2.484375 | 2 |
RecoBTag/PerformanceDB/python/measure/Btag_btagTtbarWp0612.py | ckamtsikis/cmssw | 852 | 45039 | import FWCore.ParameterSet.Config as cms
BtagPerformanceESProducer_TTBARWPBTAGCSVL = cms.ESProducer("BtagPerformanceESProducer",
# this is what it makes available
ComponentName = cms.string('TTBARWPBTAGCSVL'),
# this is where it gets the payload from
PayloadName =... | 1.773438 | 2 |
wntr/scenario/__init__.py | yejustme/WNTR | 0 | 45040 | <gh_stars>0
"""
The wntr.scenario package contains methods to define disaster scenarios and
fragility/survival curves.
"""
from wntr.scenario.earthquake import Earthquake
from wntr.scenario.fragility_curve import FragilityCurve | 1.429688 | 1 |
enthought/envisage/ui/action/action_set.py | enthought/etsproxy | 3 | 45041 | <filename>enthought/envisage/ui/action/action_set.py
# proxy module
from __future__ import absolute_import
from envisage.ui.action.action_set import *
| 1.171875 | 1 |
pypesto/objective/history.py | LukasSp/pyPESTO | 0 | 45042 | <reponame>LukasSp/pyPESTO<filename>pypesto/objective/history.py
import numpy as np
import pandas as pd
import time
import os
from .constants import MODE_FUN, MODE_RES, FVAL, GRAD, HESS, RES, SRES
from .util import res_to_chi2, sres_to_schi2
from .options import ObjectiveOptions
class ObjectiveHistory:
"""
Obj... | 2.421875 | 2 |
Preprocess.py | yuchenmo/SceneCompletion | 1 | 45043 | import numpy as np
import os
import os.path as op
import cv2
from tqdm import tqdm
import multiprocessing
from FeatureExtractor import get_gist_C_implementation
from utils import ensure_dir, info
input_dir = "./dataset/raw_image"
catalog = {}
paths = []
feats = []
for (root, dirs, files) in os.walk(input_dir):
fo... | 2.4375 | 2 |
iic/archs/__init__.py | felizang/IIC-pytorch3 | 1 | 45044 | from .cluster import *
# from .segmentation import *
# from .semisup import *
| 0.980469 | 1 |
ExtraCode/file2speech/file2speech.py | Codingmace/JARVIS | 1 | 45045 | <reponame>Codingmace/JARVIS<gh_stars>1-10
from gtts import gTTS # convert text-to-speech
import PyPDF2 # convert pdf-to-text
from PIL import Image # process images
import pytesseract # convert image to text
import os # play audio file
def convertTextToSpeech(textFi... | 3.09375 | 3 |
python/treetagger-python/treetagger3.py | semplea/characters-meta | 0 | 45046 | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Interface to the TreeTagger POS-tagger
#
# Copyright (C) <NAME>
# Author: <NAME> <<EMAIL>>
"""
A Python module for interfacing with the Treetagger by <NAME>.
"""
import os
from subprocess import Popen, PIPE
from nltk.internals import find_binary, find_file
from nlt... | 3.046875 | 3 |
StickyDJ-Bot/src/util/configmaker.py | JCab09/StickyDJ-Bot | 0 | 45047 | <reponame>JCab09/StickyDJ-Bot<gh_stars>0
#!/usr/bin/env python3
"""
This class uses the yaml-parser in order to create the
apropriate config-dictionary for the client who requested it
Author: <NAME>
"""
from src.util.parser.yaml_parser import yaml_parser
import string
def getConfig(filepath, type = '.yaml', context... | 2.796875 | 3 |
qurkexp/join/pair-results.py | marcua/qurk_experiments | 1 | 45048 | #!/usr/bin/env python
import sys, os
ROOT = os.path.abspath('%s/../..' % os.path.abspath(os.path.dirname(__file__)))
sys.path.append(ROOT)
os.environ['DJANGO_SETTINGS_MODULE'] = 'qurkexp.settings'
from django.core.management import setup_environ
from django.conf import settings
from qurkexp.join.models import *
from q... | 1.835938 | 2 |
exchange_plugin/consumer.py | FastyBird/application-exchange | 0 | 45049 | <filename>exchange_plugin/consumer.py
#!/usr/bin/python3
# Copyright 2021. FastyBird s.r.o.
#
# 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/... | 1.898438 | 2 |
plasmapy/utils/tests/test_checks.py | ludoro/PlasmaPy | 1 | 45050 | <reponame>ludoro/PlasmaPy
"""Tests for methods relating to quantities."""
import numpy as np
from astropy import units as u
import pytest
from ...constants import c
from ..checks import (
_check_quantity, _check_relativistic, check_relativistic,
check_quantity
)
# (value, units, error)
quantity_error_exampl... | 2.421875 | 2 |
strategy/IStrategy.py | chung-ejy/longshot | 0 | 45051 | <filename>strategy/IStrategy.py<gh_stars>0
from abc import ABCMeta, abstractmethod
## sources https://realpython.com/python-interface/
## https://docs.python.org/3/library/abc.html
class IStrategy(metaclass=ABCMeta):
@classmethod
def __subclasshook_(cls,subclass):
return (hasattr(subclass,"subscribe") ... | 2.65625 | 3 |
symbol_tables/LinearProbingHashST.py | okebinda/algorithms.python | 0 | 45052 | <reponame>okebinda/algorithms.python
"""Symbol Table: Linear Probing Hash"""
from collections.abc import MutableMapping
from random import randrange
class LinearProbingHashST(MutableMapping):
"""A symbol table with key:value pairs implemented using a hash function on
the keys to store items, maintaining fast... | 3.765625 | 4 |
{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/wsgi.py | YE-Kits/cookiecutter-falcon | 1 | 45053 | <filename>{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/wsgi.py<gh_stars>1-10
from {{cookiecutter.project_name}}.main import create_app
app = create_app()
| 1.21875 | 1 |
test/test_sshtype.py | stribika/sshlabs | 76 | 45054 | <reponame>stribika/sshlabs
import sys
import unittest
sys.path.append("../main")
from sshtype import *
class TestUInt32(unittest.TestCase):
def test_from_bytes(self):
uint32 = UInt32()
self.assertEqual(uint32.from_bytes(b"\x00\x00\x01\x02"), (b"", 0x102))
def test_to_bytes(self):
uin... | 2.625 | 3 |
eventlet_raft/tests/test_client.py | jason-ni/eventlet-raft | 3 | 45055 | from glob import glob
import os
from unittest import TestCase
from nose.plugins.attrib import attr
from ..client import RaftClient
class RaftClientTest(TestCase):
@classmethod
def tearDownClass(cls):
map(os.remove, glob('./~test_file*'))
@attr("integration")
def test_client_init(self):
... | 1.953125 | 2 |
roc-prepare3.py | catherinekerr/ip-ensemble | 1 | 45056 | <filename>roc-prepare3.py
"""
Construct the ROC plot.
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE file in the root
directory of this source tree or at
http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works of this code m... | 2.046875 | 2 |
gbmplus/api/orders.py | markzuckerbergas/gbmplus-api-python | 13 | 45057 | from datetime import datetime, timezone
from ..exceptions import *
class Orders(object):
def __init__(self, session, trading_types):
super(Orders, self).__init__()
self._session = session
self._trading_types = trading_types
def generateOrderObject(self, legacy_contract_id, issuer, quan... | 2.859375 | 3 |
phipkit/antigen_analysis.py | openvax/phipkit | 0 | 45058 | import collections
import numpy
import pandas
import scipy
from tqdm import tqdm
from .common import say, reconstruct_antigen_sequences
def compute_coverage(antigen, sequence, blast_df):
"""
Extract blast hits for some clones for a single antigen into a DataFrame
indicating whether each clone aligns at... | 3.078125 | 3 |
go/contacts/import_handlers.py | lynnUg/vumi-go | 0 | 45059 | from go.contacts import tasks, utils
from go.contacts.parsers import ContactFileParser
class ContactImportException(Exception):
"""
Exception raised when an import handler determines that an import cannot
succeed.
"""
def dispatch_import_task(import_task, request, group, check_fields=None):
file... | 2.21875 | 2 |
model.py | cynthia3r/flower_image_classifier | 1 | 45060 | <gh_stars>1-10
import torch
from torchvision import models
import time
'''
Functions related to training model
'''
def save_checkpoint(model, optimizer, train_data, arch, save_dir):
# TODO COMPLETED: Save the checkpoint
model.to('cpu')
print("Our model: \n\n", model, '\n')
print("The state dict keys... | 2.640625 | 3 |
Python3/Tornado/apps/pg/PG_Deposit/test/test_request.py | youngqqcn/QBlockChainNotes | 24 | 45061 | <gh_stars>10-100
#!coding:utf8
#author:yqq
#date:2020/8/14 0014 19:26
#description:
import requests
def main():
url = 'http://htdf2020-test01.orientwalt.cn:1317/block_detail/1009408'
r = requests.get(url=url)
r.encoding = 'utf8'
print(r.text)
pass
if __name__ == '__m... | 2.109375 | 2 |
test_project/test_project/settings_pytest.py | mpasternak/django-reciprocity | 1 | 45062 | # Settings for testing with included docker-compose and pytest
from .settings import * # noqa
# Subscribe from remote selenium container to docker-compose nginx container
NGINX_PUSH_STREAM_PUB_HOST = "localhost"
NGINX_PUSH_STREAM_PUB_PORT = "9080"
# Subscribe from local TravisCI machine to docker-compose nginx cont... | 1.226563 | 1 |
BrainML/optimizer.py | bogdan124/DeepML | 0 | 45063 | <reponame>bogdan124/DeepML<gh_stars>0
import tensorflow as tf
class Optimizer:
def __init__(self,optimizerName=None):
"""
Here you have the Optimizer class, optimizerName is the optimizer that you want to chose:
ex: Optimizer("Adam")
optimizerName can be one of the following Adam, Adadelta, Adagrad... | 3.40625 | 3 |
tests/build_test_output.py | john-grando/pyExpandObjects | 0 | 45064 | import os
import pandas as pd
base_project_path = os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)
)
)
def make_table(df):
html_tables = {}
df[['DocSection', 'DocText']] = df["DocText"].str.rsplit(":", 1, expand=True)
for section, sub_df in df.groupby(['DocSection']):
s... | 3.015625 | 3 |
UnitGenerServer.py | SachithS/UnitGener | 0 | 45065 | """
UnitGenerCore.py - Server of the UnitGener
This file is responsible for creating the routes and the server of the UnitGener core module.
Will create all the needed routes with params and initiate the server.
@author <NAME>
@version 1.0
@maintainer <NAME>
@copyright Copyright 2017, The Un... | 2.375 | 2 |
setup.py | Califrais/lights | 6 | 45066 | <filename>setup.py
from setuptools import setup
setup(
name='lights',
version='0.1',
author="<NAME>",
description="ligths is a generalized joint model for high-dimensional multivariate longitudinal data and censored durations",
url="https://github.com/Califrais/lights",
) | 1.054688 | 1 |
Task1F.py | Nikko10Have/CompLent | 0 | 45067 | <reponame>Nikko10Have/CompLent<gh_stars>0
from floodsystem.stationdata import build_station_list
from floodsystem.station import inconsistent_typical_range_stations
from floodsystem.station import MonitoringStation
# List of Stations
stations = build_station_list()
incon = inconsistent_typical_range_stations(stations)... | 2.78125 | 3 |
pycg/machinery/imports.py | WenJinfeng/PyCG | 121 | 45068 | #
# Copyright (c) 2020 <NAME>.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0... | 2.015625 | 2 |
aquarius/events/processors.py | oceanprotocol/provider-backend | 0 | 45069 | <gh_stars>0
#
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import copy
import json
import logging
import os
from abc import ABC
from datetime import datetime
from jsonsempai import magic # noqa: F401
from aquarius.ddo_checker.shacl_checker import validate_dict
from aquarius.even... | 1.898438 | 2 |
examples/mocsar_pl_cfg_human.py | cogitoergoread/muszi-macrohard.hu | 1 | 45070 | """
A toy example of playing against defined set of bots on Mocsár
Using env "mocsar"-cfg Using 'human_mode'
"""
import rlcard3
# Make environment and enable human mode
env = rlcard3.make('mocsar-cfg', config={'human_mode': True})
# Register agents
agents = {"mocsar_random": 2, "mocsar_min": 2}
env.model.create_agen... | 3.109375 | 3 |
drones/version.py | bugout-dev/drones | 0 | 45071 | <reponame>bugout-dev/drones
"""
Drones library and API version.
"""
DRONES_VERSION = "0.1.2"
| 0.863281 | 1 |
utils/prepare_bcp.py | smeea/krcg-static | 0 | 45072 | """A convenience function to rename BCP images
"""
import os
import re
from krcg.parser import _CLAN
def prepare_bcp(path):
for (dirpath, _dirnames, filenames) in os.walk(path):
for name in filenames:
clan_prefix = re.match(r"({})_".format(_CLAN), name.lower())
if clan_prefix:
... | 3.125 | 3 |
openpype/hosts/houdini/vendor/husdoutputprocessors/stagingdir_processor.py | jonclothcat/OpenPype | 87 | 45073 | import hou
import husdoutputprocessors.base as base
import os
class StagingDirOutputProcessor(base.OutputProcessorBase):
"""Output all USD Rop file nodes into the Staging Directory
Ignore any folders and paths set in the Configured Layers
and USD Rop node, just take the filename and save into a
singl... | 2.46875 | 2 |
modules/useless_print.py | ploggingdev/python_learn | 10 | 45074 | def useless_print(content):
'''Print the argument recieved'''
print(content)
if __name__ == "__main__":
import sys
useless_print(sys.argv[1]) | 2.328125 | 2 |
mit_d3m/db.py | micahjsmith/mit-d3m | 6 | 45075 | <reponame>micahjsmith/mit-d3m<filename>mit_d3m/db.py
# -*- coding: utf-8 -*-
import getpass
import json
import logging
from pymongo import MongoClient
LOGGER = logging.getLogger(__name__)
def get_db(database=None, config=None, **kwargs):
if config:
with open(config, 'r') as f:
config = json... | 2.421875 | 2 |
src/StandAlone/inputs/MPM/Arenisca/Arenisca3/AreniscaTestSuite_PostProc.py | abagusetty/Uintah | 3 | 45076 | <reponame>abagusetty/Uintah<gh_stars>1-10
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import math
import tempfile
import numpy as np
import subprocess as sub_proc
#Plotting stuff below
from matplotlib import rc
import matplotlib.pyplot as plt
from matplotlib import ticker
SHOW_ON_MAKE = False
#Usefu... | 2.28125 | 2 |
camDataSub.py | hodoemelem/A-Rapid-Prototyping-Framework-for-Human-Robot-Interaction | 2 | 45077 | #!~/.virtualenvs/cv420/bin/python
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Created: 4-May-2020
"""
import serial
import math
from threading import Thread
import rospy
import time
import numpy as np
from std_msgs.msg import String
ser = serial.Serial('/dev/ttyACM1',9600, timeout=5) # Ti MSP430
def inverse_Kinema... | 2.5625 | 3 |
oop-intro/first-oop.py | BicycleWalrus/slop | 0 | 45078 | #!/usr/bin/env python3
"""TPatrick | Alta3 Research
Creating a simple dice program utilizing classes."""
from random import randint
class Player:
def __init__(self):
self.dice = []
def roll(self):
self.dice = []
for i in range(3):
self.dice.append(randint(1,6))
de... | 3.984375 | 4 |
src/__main__.py | bahorn/backup_script | 0 | 45079 | <reponame>bahorn/backup_script<filename>src/__main__.py
"""
A tool to generate scripts using rclone to do backups.
Allows some sanity checking over your config, etc.
The scripts outputted are meant to be human readable.
"""
import sys
import toml
from config import Config
from tool import BackupScript
def main(args... | 2.25 | 2 |
auto_sync.py | AnonyZeus/face-detection | 0 | 45080 | <reponame>AnonyZeus/face-detection
import os
import subprocess
import argparse
import ntpath
import shutil
from extract_embeddings import extract_data
from train_model import train_model
def copytree(src, dst, symlinks=False, ignore=None):
for item in os.listdir(src):
s = os.path.join(src, item)
d ... | 2.4375 | 2 |
python.py | Xsmael/blockhain-implementation | 2 | 45081 | import json
a= [1,2,3,4,5,6,7,8,9,10]
print(a)
b=[el*2 for el in a] # double everything
print(b)
print([el*10 for el in a]) # 10X everything
print([el for el in a if el%2 ==0]) # filter even nums
print([el for el in a if el%2 !=0]) # filter odd nums
print([el for el in a if el%5 ==0]) # filter multiples of 5
c=... | 3.515625 | 4 |
unlock/unlock/unlockvisitor.py | joshwatson/f-ing-around-with-binaryninja | 88 | 45082 | <gh_stars>10-100
# This script requires python 3
import operator as op
import time
from functools import partial
from queue import Queue
from threading import Event
from math import floor
from binaryninja import (
AnalysisCompletionEvent,
Architecture,
ArchitectureHook,
BackgroundTaskThread,
BasicB... | 1.882813 | 2 |
dynamo/api/views.py | rendrom/django-dynamit | 3 | 45083 | # coding=utf-8
from dynamo.api.serializers import DynamicModelSerializer, DynamicModelFieldSerializer
from dynamo.models import DynamicModel, DynamicModelField
from rest_framework import viewsets
from rest_framework import generics
from rest_framework.renderers import TemplateHTMLRenderer, JSONRenderer, HTMLFormRendere... | 1.992188 | 2 |
kfusiontables/models.py | kula1922/kfusiontables | 4 | 45084 | from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import post_save
from django.utils.translation import ugettext_lazy as _
class TableMap(models.Model):
"""
Combines local tables with google fusion tables via
fusiontable table id and local name created fro... | 2.21875 | 2 |
cdk/stacks/bucket_stack.py | trdarr/ebooks2 | 0 | 45085 | <reponame>trdarr/ebooks2<filename>cdk/stacks/bucket_stack.py
from aws_cdk import aws_s3 as s3
from aws_cdk import core
class BucketStack(core.Stack):
def __init__(self, scope, stack_id, *, bucket_name, **kwargs):
super().__init__(scope, stack_id, **kwargs)
# shit i forgot we needed a new
... | 2.3125 | 2 |
src/products/migrations/0006_ShippableFullName.py | denkasyanov/education-backend | 151 | 45086 | <gh_stars>100-1000
# Generated by Django 2.2.7 on 2019-11-15 21:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0005_ClickMeeetingRoomURL'),
]
operations = [
migrations.AddField(
model_name='course',
... | 1.742188 | 2 |
convert_xml_to_xls.py | CharlesBuy/pyxmlspreadsheet | 0 | 45087 | #
# - Very simple code to convert from office spreadsheet to xls
#
# <EMAIL>
#
import sys
import xml.etree.ElementTree as ET
import xlwt
from dateutil.parser import parse
class xml_workbook():
#hard code a tag here
_tag_prefix = "{urn:schemas-microsoft-com:office:spreadsheet}"
def _wt(self, key):
return sel... | 3.328125 | 3 |
01_tsv_to_csv_clean_fix.py | dmitry-dereshev/IMDb | 0 | 45088 | <filename>01_tsv_to_csv_clean_fix.py
# Part of IMDb project by <NAME>. 2019 MIT Licence.
# https://github.com/dmitry-dereshev/IMDb
# This script looks through a folder to pick up .tsv files, remove '\N', and
# convert them to Unicode-compliant .csv files.
# Original data from: https://www.imdb.com/interfaces/
... | 2.90625 | 3 |
beryllia/util.py | examknow/beryllia | 0 | 45089 | import re, traceback
from datetime import timedelta
from ipaddress import ip_address, IPv4Address, IPv6Address
from ipaddress import ip_network, IPv4Network, IPv6Network
from typing import List, Optional, Set, Tuple, Union
from ircrobots import Server
from irctokens import build
from ircchallenge import Ch... | 2.453125 | 2 |
app/order_api/__init__.py | peterboldizs/Hands-on-Microservices-with-Python-Order-Service | 14 | 45090 | from flask import Blueprint
order_api_blueprint = Blueprint('order_api', __name__)
from . import routes | 1.359375 | 1 |
hookit/exc.py | xhs/hookit | 1 | 45091 | <reponame>xhs/hookit
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class HookitConnectionError(Exception):
pass
__all__ = ['HookitConnectionError']
| 1.328125 | 1 |
AutoRecon-main/autorecon/default-plugins/nmap-oracle.py | Nano-Techx/nano-tool | 0 | 45092 | <filename>AutoRecon-main/autorecon/default-plugins/nmap-oracle.py
from autorecon.plugins import ServiceScan
class NmapOracle(ServiceScan):
def __init__(self):
super().__init__()
self.name = "Nmap Oracle"
self.tags = ['default', 'safe', 'databases']
def configure(self):
self.match_service_name('^oracle')
... | 2.25 | 2 |
samsungctl/upnp/UPNP_Device/upnp_class.py | p3g4asus/samsungctl | 135 | 45093 | # -*- coding: utf-8 -*-
import requests
import os
from lxml import etree
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
try:
from .xmlns import strip_xmlns
from .service import Service
from .embedded_device import EmbeddedDevice
from .instance_singlet... | 2.5 | 2 |
sweden_crs_transformations/transformation/_transform_strategy_from_sweref99_or_rt90_to_wgs84_and_then_to_real_target.py | TomasJohansson/sweden_crs_transformations_4python | 1 | 45094 | <gh_stars>1-10
"""
| Copyright (c) <NAME> , http://www.programmerare.com
| The code in this library is licensed with MIT.
| The library is based on the C#.NET library 'sweden_crs_transformations_4net' (https://github.com/TomasJohansson/sweden_crs_transformations_4net)
| which in turn is based on 'MightyLittleGeodesy' ... | 1.625 | 2 |
frontend/utils.py | fiamonci/covidapi | 0 | 45095 | import plotly.offline as py
import plotly.graph_objs as go
import plotly.figure_factory as ff
import pandas as pd
import numpy as np
def plotlinechart(data_list, countries, plot_name):
data_list.index = data_list.index.strftime("%Y-%m-%d")
fig = go.Figure()
if not countries:
countries = data_li... | 2.71875 | 3 |
pyglobi/__init__.py | nicholac/pyglobi | 0 | 45096 | # -*- coding: utf-8 -*-
# PyGlobi
# TODO:
"""
PyGlobi Library
~~~~~~~~~~~~~~~~~~~~~
Python API for the Global Biotic Interactions (GloBI) dataset.
Basic usage:
>>> import pyglobi
>>> ...
"""
import os
import json
import warnings
from .__version__ import __title__, __description__, __url__, __version__
from .... | 1.804688 | 2 |
software/misc/get_gene_ne.py | Searchlight2/Searchlight2 | 17 | 45097 | <gh_stars>10-100
def get_gene_ne(global_variables,gene_dictionary):
values_list = []
# gets the ordered samples
sample_list = global_variables["sample_list"]
for sample in sample_list:
values_list.append(gene_dictionary[sample])
return values_list
| 2.359375 | 2 |
Kryptografie/Python/caesar.py | jneug/schule-projekte | 2 | 45098 |
def ceasear_encode( msg, key ):
code = ""
key = ord(key.upper())-ord("A")
for c in msg.upper():
if c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
new_ord = ord(c)+key
if new_ord > ord("Z"):
new_ord -= 26
code += chr(new_ord)
else:
code +=... | 3.53125 | 4 |
tools/lathethreadingtool.py | codemakeshare/g-mint | 1 | 45099 | from guifw.abstractparameters import *
from geometry import *
from solids import *
import multiprocessing as mp
import time
import pyclipper
from polygons import *
from gcode import *
from collections import OrderedDict
class LatheThreadingTool(ItemWithParameters):
def __init__(self, model=None, tools=[], view... | 2.34375 | 2 |