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 |
|---|---|---|---|---|---|---|
obj_sys/obj_tools.py | weijia/obj_sys | 0 | 39000 | import socket
import logging
from ufs_tools import format_path
def get_fs_protocol_separator():
try:
import configurationTools as config
return config.getFsProtocolSeparator()
except ImportError:
return "://"
gUfsObjUrlPrefix = u'ufs' + get_fs_protocol_separator()
gUfsObjUrlSeparator... | 2.75 | 3 |
django_pandas/tests/models.py | patseng/django-pandas | 0 | 39001 | <filename>django_pandas/tests/models.py
from django.db import models
from django_pandas.managers import DataFrameManager
class DataFrame(models.Model):
index = models.CharField(max_length=1)
col1 = models.IntegerField()
col2 = models.FloatField()
col3 = models.FloatField()
col4 = models.IntegerFi... | 2.25 | 2 |
src/apps/recommendations/tests/x_test_comparable_inventories.py | Remy-TPP/q-api | 0 | 39002 | from unittest import TestCase
from apps.profiles.models import Profile
from apps.recipes.models import Recipe, Ingredient
from apps.recommendations.utils import ComparableInventory
# TODO: written for manual testing with preloaded db; for general use should create resources in setUp()
class ComparableInventoryTest(T... | 2.546875 | 3 |
api/migrations/0076_auto_20200728_1500.py | IFRCGo/ifrcgo-api | 11 | 39003 | # Generated by Django 2.2.13 on 2020-07-28 15:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0075_profile_last_frontend_login'),
]
operations = [
migrations.RemoveField(
model_name='fieldreport',
name='cases',... | 1.6875 | 2 |
main.py | alextremblay962/Hydropinic_System | 0 | 39004 | import serial
import json
import io
import time
ser = serial.Serial("COM24" , 9600, timeout=2)
topic = "hydro/light1"
payload = 1
#data = json.dumps({"topic":topic,"payload":payload})
data = "{\"topic\":\"hydro/light1\",\"payload\":1}"
data = data.encode()
print(data)
ser.write(b'A')
hello = ser.readline()#.dec... | 2.484375 | 2 |
level_3/challenge_2.py | mouse-reeve/foobar | 0 | 39005 | <filename>level_3/challenge_2.py
''' Compute a digest message '''
def answer(digest):
''' solve for m[1] '''
message = []
for i, v in enumerate(digest):
pv = message[i - 1] if i > 0 else 0
m = 0.1
a = 0
while m != int(m):
m = ((256 * a) + (v ^ pv)) / 129.0
... | 3.59375 | 4 |
pacote-download/pythonProject/exercicios_python_guanabara/ex019.py | oliveirajonathas/python_estudos | 0 | 39006 | import random
aluno1 = input('Nome aluno 1: ')
aluno2 = input('Nome aluno 2: ')
aluno3 = input('Nome aluno 3: ')
aluno4 = input('Nome aluno 4: ')
sorteado = random.choice([aluno1, aluno2, aluno3, aluno4])
print('O sorteado para apagar o quadro foi: {}'.format(sorteado))
| 3.59375 | 4 |
tests/test_reset_plot.py | l-johnston/toolbag | 0 | 39007 | <filename>tests/test_reset_plot.py
"""Test reset_plot"""
import matplotlib.pyplot as plt
from toolbag import reset_plot
plt.ion()
# pylint: disable = missing-function-docstring
def test_reset_plot():
fig, ax = plt.subplots()
ax.plot([1, 2, 3])
plt.close()
reset_plot(fig)
assert id(ax) == id(fig.gc... | 2.15625 | 2 |
af/shovel/oonipl/popen.py | mimi89999/pipeline | 0 | 39008 | <gh_stars>0
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE
from contextlib import contextmanager
@contextmanager
def ScopedPopen(*args, **kwargs):
proc = Popen(*args, **kwargs)
try:
yield proc
finally:
try:
proc.kill()
except Except... | 2.203125 | 2 |
software/dsp/ddc.py | loxodes/phasenoise | 14 | 39009 | <reponame>loxodes/phasenoise
from migen import *
from nco import NCO
from mixer import Mixer
from cic import CIC, CompensationFilter
import numpy as np
import matplotlib.pyplot as plt
class DDC(Module):
def __init__(self, input_bits = 12, output_bits = 16, phaseinc_bits = 18, nco_bits = 18, if_bits = 20):
... | 2.296875 | 2 |
profileparser.py | JimKnowler/profile-visualiser | 3 | 39010 | <reponame>JimKnowler/profile-visualiser
class ProfileParser:
def __init__(self, consumer):
self._consumer = consumer
def load_file(self, filename):
with open(filename, "r") as file:
for line_number, line in enumerate(file):
try:
line = line.rstrip()
self.parse(line)
except Exception as e:
... | 2.75 | 3 |
moog/tasks/composite_task.py | juanpablordz/moog.github.io | 22 | 39011 | <reponame>juanpablordz/moog.github.io
"""Composite task."""
from . import abstract_task
import numpy as np
class CompositeTask(abstract_task.AbstractTask):
"""CompositeTask task.
This combines multiple tasks at once, summing the rewards from each of them.
This can be useful for example to have a predato... | 3.453125 | 3 |
main/api/fields.py | lipis/gae-init-magic | 465 | 39012 | <gh_stars>100-1000
# coding: utf-8
import urllib
from flask_restful import fields
from flask_restful.fields import *
class BlobKey(fields.Raw):
def format(self, value):
return urllib.quote(str(value))
class Blob(fields.Raw):
def format(self, value):
return repr(value)
class DateTime(fields.DateTime)... | 2.59375 | 3 |
polls/views.py | pygabo/omnik | 0 | 39013 | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from django.http import HttpResponse
from django.urls import reverse
from django.views.generic import ListView,DetailView
from .models import Poll, Choice
class IndexView(ListView):
context_object_name... | 2.515625 | 3 |
tests/test_contextmanager.py | eagleshine/invirtualenv | 15 | 39014 | import os
import unittest
import invirtualenv.contextmanager
class TestContextmanager(unittest.TestCase):
def test__revert_file(self):
with invirtualenv.contextmanager.InTemporaryDirectory():
with open('testfile', 'w') as fh:
fh.write('original')
self.assertEqual('o... | 2.875 | 3 |
xero/filesmanager.py | Ian2020/pyxero | 246 | 39015 | <filename>xero/filesmanager.py
from __future__ import unicode_literals
import os
import requests
from six.moves.urllib.parse import parse_qs
from .constants import XERO_FILES_URL
from .exceptions import (
XeroBadRequest,
XeroExceptionUnknown,
XeroForbidden,
XeroInternalError,
XeroNotAvailable,
... | 2.359375 | 2 |
jobs/migrations/0055_savedfeatureselection_uid.py | hotosm/hot-exports-two | 95 | 39016 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-06-26 12:06
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('jobs', '0054_savedfeatureselection'),
]
operations = [
... | 1.75 | 2 |
unified_planning/plans/partial_order_plan.py | aiplan4eu/unified-planning | 9 | 39017 | <reponame>aiplan4eu/unified-planning
# Copyright 2021 AIPlan4EU project
#
# 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 ... | 2.40625 | 2 |
tests/params.py | cponecp/iHone | 0 | 39018 | def fun(default=None,**kwargs):
print(1)
fun(user='cp',default={}) | 2.171875 | 2 |
orquesta/tests/unit/graphing/native/test_routes_split.py | batk0/orquesta | 0 | 39019 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | 1.789063 | 2 |
test_client.py | lilydjwg/udt_py | 9 | 39020 | <gh_stars>1-10
#!/usr/bin/env python3
import udt
import socket
import time
s = udt.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
s.connect(("localhost", 5555))
print("Sending...")
s.send(b"Hello", 0)
buf = s.recv(1024, 0)
print(repr(buf))
| 2.359375 | 2 |
core_lib/rule_validator/rule_validator_decorator.py | shubham-surya/core-lib | 0 | 39021 | <gh_stars>0
from functools import wraps
from core_lib.helpers.func_utils import get_func_parameter_index_by_name
from core_lib.rule_validator.rule_validator import RuleValidator
class ParameterRuleValidator(object):
def __init__(self,
rule_validator: RuleValidator,
parameter_na... | 2.453125 | 2 |
logistic_regression_08/main.py | michaellengyel/cifar_image_recognition | 0 | 39022 | import torch
import torch.nn as nn
import numpy as np
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
class LogisticRegression(nn.Module):
def __init__(self, n_input_features):
super(Logis... | 3.125 | 3 |
obkey_parts/__version__.py | evyd13/obkey3 | 4 | 39023 | """
Obkey package informations.
This file is a part of Openbox Key Editor
Code under GPL (originally MIT) from version 1.3 - 2018.
See Licenses information in ../obkey .
"""
MAJOR = 1
MINOR = 3
PATCH = 2
__version__ = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH)
__description__ = 'Openbox Key Editor'
__long_des... | 1.15625 | 1 |
PSA/modules/BroEventDispatcher.py | SECURED-FP7/secured-psa-nsm | 0 | 39024 | # -*- Mode:Python;indent-tabs-mode:nil; -*-
#
# BroEventDispatcher.py
#
# A simple event dispatcher.
#
# Author: jju / VTT Technical Research Centre of Finland Ltd., 2016
#
import logging
callbacks = { }
def init():
pass
def register( key, obj ):
"""
Register a callback for key 'key'
"""
global ... | 2.671875 | 3 |
scripts/molecules.py | abelcarreras/PyQchem | 16 | 39025 | from pyqchem.structure import Structure
import numpy as np
# Ethene parallel position
def dimer_ethene(distance, slide_y, slide_z):
coordinates = [[0.0000000, 0.0000000, 0.6660120],
[0.0000000, 0.0000000, -0.6660120],
[0.0000000, 0.9228100, 1.2279200],
... | 2.203125 | 2 |
twitter_monitor/twitter_bot_runner.py | coffeerightnow/TwitterMonitor | 0 | 39026 | <reponame>coffeerightnow/TwitterMonitor<gh_stars>0
import logging
from .config_loader import BackendConfig
import time
from .data_processing import TwitterStreamListener, TweetProcessor, TweetQueue
# load configuration
config = BackendConfig()
# setup Logging
logging.basicConfig(format='%(asctime)s %(message)s', level... | 2.546875 | 3 |
lib/bot/__init__.py | ItsZabbs/Pokedex-Bot | 0 | 39027 | <gh_stars>0
import discord
from discord.ext import commands
import dotenv
import os
from glob import glob
import traceback
from ..db import db
# Loading the environment variables
dotenv.load_dotenv()
token = os.getenv("BOT_TOKEN")
error_guild_id = os.getenv("GUILD_ID")
error_channel_id = os.getenv("CHANNEL_ID")
feed... | 2.296875 | 2 |
StackApp/env/lib/python2.7/site-packages/blueprint/backend/files.py | jonathanmusila/StackOverflow-Lite | 0 | 39028 | <filename>StackApp/env/lib/python2.7/site-packages/blueprint/backend/files.py
"""
Search for configuration files to include in the blueprint.
"""
import base64
from collections import defaultdict
import errno
import glob
import grp
import hashlib
import logging
import os.path
import pwd
import re
import stat
import su... | 1.992188 | 2 |
control/adaptive_affine.py | jnez71/misc | 3 | 39029 | #!/usr/bin/env python3
"""
Adaptive Affine Control:
My favorite myopic (not MPC, DP, or RL) control-law when absolutely nothing is known about your system except
that the control is additive and fully-actuated:
```
dx/dt = f(x,t) + u # drift f unknown, state x at time t known, choose control u to make x=r
u = W... | 3.375 | 3 |
hermione/module_templates/__IMPLEMENTED_BASE__/src/ml/preprocessing/preprocessing.py | RodrigoATorres/hermione | 183 | 39030 | <filename>hermione/module_templates/__IMPLEMENTED_BASE__/src/ml/preprocessing/preprocessing.py
import pandas as pd
from ml.preprocessing.normalization import Normalizer
from category_encoders import *
import logging
logging.getLogger().setLevel(logging.INFO)
class Preprocessing:
"""
Class to perform data pre... | 2.921875 | 3 |
python-backend/tests/status/resources/test_mine_status_resource.py | MaxWardle/mds | 0 | 39031 | import json
from app.api.constants import MINE_STATUS_OPTIONS
from tests.constants import TEST_MINE_GUID
# GET
def test_get_mine_status_option(test_client, auth_headers):
get_resp = test_client.get('/mines/status', headers=auth_headers['full_auth_header'])
get_data = json.loads(get_resp.data.decode())
as... | 2.21875 | 2 |
DevTools/lineCount.py | spiiin/CadEditor | 164 | 39032 | #!/usr/bin/env python2
#Script for calculate LoC of all source files of project
import os,string
import sys
extension_list = ['h','hpp','cpp','c','pas','dpr','asm','py','q3asm','def','sh','bat','cs','java','cl','lisp','ui',"nut"]
comment_sims = {'asm' : ';', 'py' : '#', 'cl':';','lisp':';'}
source_files = { }
... | 2.78125 | 3 |
objectrocket/instances/mongodb.py | objectrocket/python-client | 5 | 39033 | """MongoDB instance classes and logic."""
import datetime
import json
import logging
import time
import pymongo
import requests
from concurrent import futures
from distutils.version import LooseVersion
from objectrocket import bases
from objectrocket import util
logger = logging.getLogger(__name__)
class MongodbI... | 2.4375 | 2 |
quickforex/providers/__init__.py | jean-edouard-boulanger/python-quickforex | 0 | 39034 | from quickforex.providers.base import ProviderBase
from quickforex.providers.provider_metadata import (
ProviderMetadata,
SettingFieldDescription,
)
from quickforex.providers.exchangerate_host import ExchangeRateHostProvider
from quickforex.providers.dummy import DummyProvider
__all__ = [
"ProviderBase",
... | 1.234375 | 1 |
springleaf/generator.py | OMKE/SpringLeaf | 9 | 39035 | from springleaf.utils.file_handler import FileHandler
from springleaf.utils.template_util import TemplateUtil
from .base_generator import BaseGenerator
class Generator(BaseGenerator):
def __init__(self, selected_file, files_to_create, attributes, structure):
super().__init__()
self.file = select... | 2.4375 | 2 |
MetadataProvider/metadata_provider.py | PiotrJTomaszewski/InternetRadioReciever | 0 | 39036 | from mpd_connection import MPDConnection
from processing_metadata import process_metadata, join_metadata
from lastfm_api import LastFmMetadataGetter, LastFmApiException
from multiprocessing.managers import SyncManager
from multiprocessing import Event
import time
# Shared objects
shared_song_metadata = {}
shared_mpd_s... | 2.125 | 2 |
src/dataset.py | EmanuelSamir/adaptive-learning-qpcbfclf-elm | 0 | 39037 | <reponame>EmanuelSamir/adaptive-learning-qpcbfclf-elm
from collections import deque, namedtuple
import random
class ELMDataset:
def __init__(self, dt, features = ('x'), time_th = 0.5, maxlen = 5):
self.time_th = time_th
self._maxlen = maxlen
self.D_pre = deque()
self.D_post = deque(... | 3.140625 | 3 |
python/rna-transcription/rna_transcription.py | guillaume-martin/exercism | 0 | 39038 | <reponame>guillaume-martin/exercism<filename>python/rna-transcription/rna_transcription.py
def to_rna(dna_strand):
pairs = {'G':'C','C':'G','T':'A','A':'U'}
return ''.join(pairs[n] for n in dna_strand) | 3.125 | 3 |
common/stat.py | 7workday/TT | 0 | 39039 | <gh_stars>0
'''程序的状态码'''
OK = 0
class LogicErr(Exception):
code = None
data = None
def __init__(self,data=None):
self.data = data or self.__class__.__name__ # 如果 data 为 None, 使用类的名字作为 data 值
def gen_logic_err(name, code):
'''生成一个新的 LogicErr 的子类 (LogicErr 的工厂函数)'''
return type(name, (Lo... | 2.484375 | 2 |
pythontutor-ru/02_ifelse/09_bishop_move.py | ornichola/learning-new | 2 | 39040 | '''
http://pythontutor.ru/lessons/ifelse/problems/bishop_move/
Шахматный слон ходит по диагонали.
Даны две различные клетки шахматной доски, определите, может ли слон попасть с первой клетки на вторую одним ходом.
'''
a_x = int(input())
a_y = int(input())
b_x = int(input())
b_y = int(input())
if abs(a_x - b_x) == abs... | 4.03125 | 4 |
zebROS_ws/src/controller_node/scripts/transform_odom.py | mattwalstra/2019RobotCode | 4 | 39041 | #!/usr/bin/env python
import rospy
import tf
from nav_msgs.msg import Odometry
import numpy as np
import sys
import math
def qv_mult(q, v):
v_unit = None
if v == [0, 0, 0]: v_unit = [0.0, 0.0, 0.0]
else: v_unit = tf.transformations.unit_vector(v)
qp = list(v_unit)
qp.append(0.0)
return t... | 2.234375 | 2 |
Aula07/chef007.py | AdryanPablo/Python | 0 | 39042 | # Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média.
nome = str(input("Digite o nome do(a) aluno(a): "))
not1 = float(input("Digite a 1ª nota de {}: ".format(nome)))
not2 = float(input("Digite a 2ª nota de {}: ".format(nome)))
media = (not1 + not2) / 2
print("Já que {} tirou {} ... | 4.0625 | 4 |
Windows10_structed_data/get_report_data.py | naporium/tools_for_windows-main | 0 | 39043 | from json import load, dumps
REPORT_FILE = "report.txt"
with open(REPORT_FILE, "r") as file:
data = load(file)
# EXAMPLE ON ACESSING THE JSON DATA REPORT
print(dumps(data["INTERFACES_INFO"]["Ethernet adapter Ethernet"], indent=4))
print(dumps(data["INTERFACES_INFO"]["Ethernet adapter Ethernet"]["IPv4 ... | 3.1875 | 3 |
fastapi/signals/__init__.py | zhangnian/fastapi | 33 | 39044 | <reponame>zhangnian/fastapi
from blinker import signal
from fastapi.signals.signal_handler import *
sig_user = signal('userinfo_modifiy')
def register_signal_handlers():
sig_user.connect(on_userinfo_modify) | 1.953125 | 2 |
kevlar/augment.py | johnsmith2077/kevlar | 24 | 39045 | <filename>kevlar/augment.py
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2018 The Regents of the University of California
#
# This file is part of kevlar (http://github.com/dib-lab/kevlar) and is
# licensed under the MIT license: see LICENSE.
# ... | 2.734375 | 3 |
ML.4/animate.py | jfnavarro/old_python_courses | 1 | 39046 | <gh_stars>1-10
'''
Created on 5.10.2010.
@author: <NAME>
'''
from Tkinter import *
from PIL import Image, ImageTk
def do_animation(currentframe):
def do_image():
wrap.create_image(50,50,image=frame[currentframe])
try:
do_image()
except IndexError:
... | 3.046875 | 3 |
INFOTC_4320/Anagram_BigO/Anagram_BigO.py | j0shbl0ck/Mizzou_Coding_IT | 0 | 39047 | # October 27th, 2021
# INFOTC 4320
# <NAME>
# Challenge: Anagram Alogrithm and Big-O
# References: https://bradfieldcs.com/algos/analysis/an-anagram-detection-example/
print("===Anagram Dector===")
print("This program determines if two words are anagrams of each other\n")
first_word = input("Please enter first word: ... | 4.09375 | 4 |
mriutils/utils/tonii.py | kuangmeng/MRIUtils | 0 | 39048 | <gh_stars>0
#!/usr/bin/env python
import skimage.io as skio
from skimage.transform import resize
import nibabel as nib
class SaveNiiFile():
def __init__(self, data, save_path, new_shape = (10, 256, 256), order = 3):
self.data = data
self.save_path = save_path
self.new_shape = new_shape
... | 2.203125 | 2 |
setup.py | kevinmooreiii/moldriver | 0 | 39049 | <filename>setup.py
""" Install moldriver
"""
from distutils.core import setup
setup(name="moldr",
version="0.1.1",
packages=["moldr",
"autofile",
"autofile.info",
"autofile.file",
"autofile.system"])
| 1.375 | 1 |
satchmo/apps/payment/modules/dummy/processor.py | predatell/satchmo | 1 | 39050 | """
This is a stub and used as the default processor.
It doesn't do anything but it can be used to build out another
interface.
See the authorizenet module for the reference implementation
"""
from django.utils.translation import ugettext_lazy as _
from payment.modules.base import BasePaymentProcessor, ProcessorResult... | 2.671875 | 3 |
kitsune/community/urls.py | yfdyh000/kitsune | 0 | 39051 | <filename>kitsune/community/urls.py
from django.conf.urls import patterns, url
urlpatterns = patterns(
'kitsune.community.views',
url(r'^/contributor_results$', 'contributor_results', name='community.contributor_results'),
url(r'^/view_all$', 'view_all', name='community.view_all'),
url(r'^$', 'home', ... | 1.5625 | 2 |
sw/groundstation/tools/imu-raw-logger.py | nzjrs/wasp | 2 | 39052 | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import time
import os.path
import optparse
import gobject
import wasp
import wasp.transport as transport
import wasp.communication as communication
import wasp.messages as messages
import calibration
import calibration.utils
FREQ = 25.0 #Hz
STEP_DELAY = 5 ... | 2.421875 | 2 |
rainbowtables/directories.py | JustBennnn/rainbowtables | 3 | 39053 | """Manage the directories
This includes options to store the hashtable in a file or keep
it temporarily, where it will be returned from the function...
"""
import json
import os
import platform
from typing import Tuple, Union
from .errors import FilenameError, PathError, SystemNotSupported
__all__ = [
"set_dire... | 3.921875 | 4 |
emendation_box/serializers.py | fga-eps-mds/2017.2-SiGI-Op_API | 6 | 39054 | <gh_stars>1-10
from rest_framework import serializers
from .models import EmendationBoxStructure, EmendationBoxType, EmendationBox
class EmendationBoxTypeSerializer(serializers.ModelSerializer):
class Meta:
model = EmendationBoxType
fields = [
'id',
'description',
]... | 2.203125 | 2 |
autohandshake/src/HandshakeBrowser.py | cedwards036/autohandshake | 3 | 39055 | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from enum import Enum
import re
import os
f... | 2.984375 | 3 |
example/pums_downloader.py | opendp/opendp-pytorch | 0 | 39056 | <gh_stars>0
import zipfile
import requests
import os
import tempfile
# this script downloads additional pums data files
# legend
# https://www2.census.gov/programs-surveys/acs/tech_docs/pums/data_dict/PUMS_Data_Dictionary_2019.txt
def download_pums_data(year, record_type, state, **_kwargs):
assert record_type ... | 2.984375 | 3 |
devtracker/test_devtracker.py | satvikel4/devtracker | 1 | 39057 | <reponame>satvikel4/devtracker
import os
import csv
import time
from datetime import datetime
from datetime import timedelta
from pathlib import Path
from .dir_and_path_helpers import get_working_dir, mk_file_path, check_file
from .time_and_date_helpers import get_date, get_sec, get_time, total_time
from .time import ... | 2.375 | 2 |
ablinfer/model/normalize.py | Auditory-Biophysics-Lab/ablinfer | 0 | 39058 | <reponame>Auditory-Biophysics-Lab/ablinfer
#!/usr/bin/env python3
from collections.abc import Collection as ABCCollection
from collections.abc import Mapping as ABCMapping
from collections import OrderedDict as OD
import json
import logging
from numbers import Number
from typing import Mapping, Optional, Collection, U... | 2.359375 | 2 |
configs/example/spectre_benchmark.py | Yujie-Cui/cleanupspec | 9 | 39059 | <reponame>Yujie-Cui/cleanupspec
import m5
from m5.objects import *
#Spectre
spectre = Process() # Added by Gururaj
spectre.executable = 'spectre'
spectre.cmd = [spectre.executable]
| 1.125 | 1 |
src/networks/wav2vec2.py | nikvaessen/w2v2-speaker-few-samples | 0 | 39060 | ################################################################################
#
# Provide embeddings from raw audio with the wav2vec2 model from huggingface.
#
# Author(s): <NAME>
################################################################################
from typing import Optional, List
import torch as t
im... | 2.25 | 2 |
ai-car-simulation-master/newcar.py | Jeevananthamcse/Palanisamy | 2 | 39061 | <reponame>Jeevananthamcse/Palanisamy
# This Code is Heavily Inspired By The YouTuber: Cheesy AI
# Code Changed, Optimized And Commented By: NeuralNine (<NAME>)
import math
import random
import sys
import os
import neat
import pygame
# Constants
# WIDTH = 1600
# HEIGHT = 880
WIDTH = 1920
HEIGHT = 1080
CAR_SIZE_X = ... | 3.359375 | 3 |
calculator/calculator.py | swilltec/calculator | 0 | 39062 | """Main module."""
from functools import reduce
class Calc:
def add(self, *args):
return sum(args)
def subtract(self, a, b):
return a - b
def multiply(self, *args):
if not all(args):
raise ValueError
return reduce(lambda x, y: x*y, args)
def divide(self... | 3.5 | 4 |
utils.py | nildip/DeepLearn_NUMBERS | 1 | 39063 | <reponame>nildip/DeepLearn_NUMBERS
import matplotlib.pyplot as plt
import sys
import itertools
import numpy as np
from sklearn.metrics import confusion_matrix
from keras import backend as K
import keras
# function to plot the confusion matrix
def plot_confusion_matrix(Y_true, Y_predicted, classes, normalize=False):
... | 3.21875 | 3 |
Curso de Python USP Part1/Exercicios/ProgramaCompleto_similaridade_COH-PIAH.py | JorgeTranin/Cursos_Coursera | 0 | 39064 | import re
def le_assinatura():
"""[A funcao le os valores dos tracos linguisticos do modelo e devolve uma assinatura a ser comparada com os textos fornecidos]
Returns:
[list] -- [description]
"""
print("Bem-vindo ao detector automático de COH-PIAH.")
print("Informe a assinatura típica de... | 3.828125 | 4 |
challanges/shape-challenge/find_arrows/webcam_gui.py | fatcloud/PyCV-Climbing-Wall | 55 | 39065 | import cv2
def webcam_gui(filter_func, video_src=0):
cap = cv2.VideoCapture(video_src)
key_code = -1
while(key_code == -1):
# read a frame
ret, frame = cap.read()
# run filter with the arguments
frame_out = filter_func(frame)
# show the image... | 3.046875 | 3 |
PDBtoDots.py | RMeli/sensaas | 12 | 39066 | #!/usr/bin/python3.7
#Author: <NAME>
import sys
import os
import math
import re
import numpy as np
#print('usage: <>.py <file.pdb> \nexecute nsc to generate point-based surface and create tables and if verbose==1 files dotslabel1.xyzrgb dotslabel2.xyzrgb dotslabel3.xyzrgb and dotslabel4.xyzrgb\n')
def pdbsurface(f... | 2.453125 | 2 |
test/test_utils.py | duncanmmacleod/cwinpy | 0 | 39067 | """
Test script for utils.py function.
"""
import os
import numpy as np
import pytest
from astropy import units as u
from cwinpy.utils import (
ellipticity_to_q22,
gcd_array,
get_psr_name,
initialise_ephemeris,
int_to_alpha,
is_par_file,
logfactorial,
q22_to_ellipticity,
)
from lalpuls... | 2.65625 | 3 |
fullcontact/schema/company_schema.py | michaelcredera/fullcontact-python-client | 8 | 39068 | <filename>fullcontact/schema/company_schema.py
# -*- coding: utf-8 -*-
"""
This module serves the class for validating
FullContact Company Enrich and Search API requests.
"""
from .base.schema_base import BaseRequestSchema
class CompanyEnrichRequestSchema(BaseRequestSchema):
schema_name = "Company Enrich"
... | 1.976563 | 2 |
tests/test_pure_checker.py | best-doctor/mr_proper | 10 | 39069 | import ast
import os
from mr_proper.public_api import is_function_pure
from mr_proper.utils.ast import get_ast_tree
def test_ok_for_destructive_assignment():
funcdef = ast.parse("""
def foo(a):
b, c = a
return b * c
""".strip()).body[0]
assert is_function_pure(funcdef)
def test_is_function_pure... | 2.59375 | 3 |
app/forms/validators.py | pricem14pc/eq-questionnaire-runner | 0 | 39070 | from __future__ import annotations
import re
from datetime import datetime, timezone
from decimal import Decimal, InvalidOperation
from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Sequence, Union
import flask_babel
from babel import numbers
from dateutil.relativedelta import relativedelta
from fla... | 2.15625 | 2 |
reveries/common/publish/publish_subset.py | davidlatwe/reveries-config | 3 | 39071 | from avalon import io
def publish(asset_id, subset_name, families):
"""
Publish subset.
:param asset_id: (object)
:param subset_name: (str)
:param families: (list)
:return:
"""
subset_context = {
'name': subset_name,
'parent': asset_id,
'type': 'subset',
... | 2.234375 | 2 |
tests/test_neofoodclub.py | diceroll123/neofoodclub.py | 2 | 39072 | import unittest
from typing import Tuple
from neofoodclub import NeoFoodClub # type: ignore
from neofoodclub.types import RoundData # type: ignore
# i picked the smallest round I could quickly find
test_round_data: RoundData = {
"currentOdds": [
[1, 2, 13, 3, 5],
[1, 4, 2, 4, 6],
[1, 3, ... | 2.46875 | 2 |
backend/api/migrations/0023_auto_20190823_1611.py | yamamz/BRMI_LOANAPP | 0 | 39073 | <reponame>yamamz/BRMI_LOANAPP<filename>backend/api/migrations/0023_auto_20190823_1611.py<gh_stars>0
# Generated by Django 2.1.1 on 2019-08-23 08:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0022_auto_20190823_1553'),
]
operations =... | 1.023438 | 1 |
api/urls.py | trinhcaokhoa/Mebook_hub | 1 | 39074 | <reponame>trinhcaokhoa/Mebook_hub<filename>api/urls.py
from django.urls import path
from .views import BookView
urlpatterns = [
path('book_api', BookView.as_view()),
] | 1.726563 | 2 |
pythonnest/views.py | d9pouces/PythonNest | 1 | 39075 | """Here are defined Python functions of views.
Views are binded to URLs in :mod:`.urls`.
"""
import datetime
import hashlib
import json
import os
from distutils.version import LooseVersion
from json.encoder import JSONEncoder
from urllib.parse import quote
from django import forms
from django.conf import settings
from... | 2.125 | 2 |
dirbot/items.py | lihongqiang/crawl-image | 1 | 39076 | from scrapy.item import Item, Field
class MyImage(Item):
image_urls = Field()
images = Field()
image_paths = Field()
image_label = Field()
| 1.90625 | 2 |
olea/core/blueprints/auth/views.py | Pix-00/olea | 2 | 39077 | <reponame>Pix-00/olea<gh_stars>1-10
from flask import g
from flask_json import json_response
from core.auth import allow_anonymous
from . import bp
from .forms import ForgetPwd, Login, Refresh, ResetPwd, SetPwd, VEmail
from .services import LemonMgr, PinkMgr
@bp.route('/login', methods=['POST'])
@allow_anonymous
de... | 2.4375 | 2 |
quantitative_finance/L3/python/setup.py | InAccel/Vitis_Libraries | 0 | 39078 | """Setup inaccel-vitis package."""
from setuptools import find_namespace_packages, setup
setup(
name = 'inaccel-vitis',
packages = find_namespace_packages(include = ['inaccel.*']),
namespace_packages = ['inaccel'],
version = '0.2',
license = 'Apache-2.0',
description = 'InAccel Vitis Libraries'... | 1.265625 | 1 |
leavemanager/cli.py | kiki407/leavemanager | 0 | 39079 | <reponame>kiki407/leavemanager
# -*- coding: utf-8 -*-
"""Console script for leavemanager."""
import sys
import click
import leavemanager
from leavemanager.configuration import getconf, setconf, get_keys
from leavemanager.utils import slightlybeautify, clickDate
from leavemanager.leavemanager import Leave, AllLeave
fr... | 2.53125 | 3 |
tests/frameworks/fast/test_fast_template.py | Jhsmit/awesome-panel-extensions | 3 | 39080 | # pylint: disable=redefined-outer-name,protected-access
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring
import panel as pn
from panel import Template
from awesome_panel_extensions.frameworks.fast import FastTemplate
def test_constructor():
# Given
column = pn.Col... | 2 | 2 |
doc2json/jats2json/pmc_utils/back_tag_utils.py | josephcc/s2orc-doc2json | 132 | 39081 | <reponame>josephcc/s2orc-doc2json
from typing import Dict, List
def _wrap_text(tag):
return tag.text if tag else ''
def parse_authors(authors_tag) -> List:
"""The PMC XML has a slightly different format than authors listed in front tag."""
if not authors_tag:
return []
authors =... | 2.984375 | 3 |
machomachomangler/tests/test_destruct.py | dsteinmo/probewheel | 0 | 39082 | <reponame>dsteinmo/probewheel
import pytest
from ..destruct import StructType
_fields = [
("I", "magic"),
("c", "byte"),
]
TEST = StructType("TEST", _fields)
TEST_BE = StructType("TEST_BE", _fields, endian=">")
def test_destruct():
assert TEST.size == 5
assert TEST_BE.size == 5
raw = bytearray(... | 2.234375 | 2 |
baseline_configs/one_phase/one_phase_rgb_ppo.py | zju-zry/jueshaRearrangement. | 37 | 39083 | from typing import Dict, Any
from allenact.algorithms.onpolicy_sync.losses import PPO
from allenact.algorithms.onpolicy_sync.losses.ppo import PPOConfig
from allenact.utils.experiment_utils import LinearDecay, PipelineStage
from baseline_configs.one_phase.one_phase_rgb_base import (
OnePhaseRGBBaseExperimentConfig... | 1.992188 | 2 |
gachianalyzer/analysis_organizer.py | mitsu-ksgr/splatoon2-gachianalyzer | 0 | 39084 | import cv2
from .video_analyzer import VideoAnalyzer
class AnalysisOrganizer:
"""
VideoAnalyzer の結果を編成します.
"""
def __organize(self):
"""
self.result をイベント毎に編成しなおします.
"""
events = []
prev = self.result[0]
for i in range(1, len(self.result)):
... | 2.890625 | 3 |
setup.py | sfable/malias | 0 | 39085 | from setuptools import setup, find_packages
from malias import __version__
setup(
name = "malias",
version = __version__,
author = '<NAME>',
author_email = '<EMAIL>',
license = 'MIT',
keywords = 'malias system alias',
description = '',
url = 'https://github.com/sfable/malias',
down... | 1.28125 | 1 |
libs/strategies.py | jonowens/mr_si_boller_strategy | 0 | 39086 | <filename>libs/strategies.py
# Strategies for trading
# Import necessary libraries
import pandas as pd
from stockstats import StockDataFrame as Sdf
def test_macd_strategy(stock_df, stock_symbol):
''' Tests MACD Strategy
Args:
stock_df (df): Asset dataframe containing ticker symbol key and
colu... | 3.671875 | 4 |
hjhj.py | jatinchaudhary/python_dump | 0 | 39087 | <filename>hjhj.py
a=int(input())
b=int(input())
c=int(input())
if(a>b and a>c):
print("number 1 is greatest")
elif(b>a and b>c):
print("number 2 is greatest")
else:
print("number 3 is greatest")
| 3.953125 | 4 |
answers/x_2_6.py | ofl/kuku | 0 | 39088 | # x_2_6
#
# ヒントを参考に「a」「b」「c」「d」がそれぞれどんな値となるかを予想してください
# ヒント
print(type('桃太郎'))
print(type(10))
print(type(12.3))
a = type('777') # => str
b = type(10 + 3.5) # => float
c = type(14 / 7) # => float
d = type(10_000_000) # => int
# print(a)
# print(b)
# print(c)
# print(d)
| 3.71875 | 4 |
Python with functions/W11-12/week 12/Activities/fruit.py | marcosamos/Python-tasks-and-proyects | 0 | 39089 | <reponame>marcosamos/Python-tasks-and-proyects
def main():
# Create and print a list named fruit.
fruit_list = ["pear", "banana", "apple", "mango"]
print(f"original: {fruit_list}")
fruit_list.reverse()
print(f"Reverse {fruit_list}")
fruit_list.append("Orange")
print(f"Append Orange {fruit_... | 4.21875 | 4 |
deepcode_go_to_file_and_ignore.py | TheSecEng/sublime-plugin | 0 | 39090 | import sublime
import sublime_plugin
class DeepcodeGoToFileAndIgnoreCommand(sublime_plugin.TextCommand):
def open_file_and_add_deepcode_ignore_comment(
self, view, file, row, col, type, reason
):
view.run_command(
"deep_code_ignore",
{"point": view.text_point(row - 1, c... | 2.234375 | 2 |
src/generate_training_data.py | thesukantadey/OpeNPDN | 13 | 39091 | #BSD 3-Clause License
#
#Copyright (c) 2019, The Regents of the University of Minnesota
#
#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 code must retain the above cop... | 1.304688 | 1 |
otcextensions/sdk/cce/v3/cluster_node.py | kucerakk/python-otcextensions | 0 | 39092 | <reponame>kucerakk/python-otcextensions
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 1.867188 | 2 |
ceilometer/agent.py | aristanetworks/ceilometer | 0 | 39093 | #
# Copyright 2013 <NAME>
# Copyright 2014 Red Hat, Inc
#
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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.or... | 1.820313 | 2 |
tests/legacy/test_pypi.py | hickford/warehouse | 1 | 39094 | # Copyright 2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | 1.945313 | 2 |
analysis/gfp/seqtools.py | johli/genesis | 12 | 39095 | import numpy as np
class SequenceTools(object):
dna2gray_ = {'c': (0, 0), 't': (1, 0), 'g': (1, 1), 'a': (0, 1)}
gray2dna_ = {(0, 0): 'c', (1, 0): 't', (1, 1): 'g', (0, 1): 'a'}
codon2protein_ = {'ttt': 'f', 'ttc': 'f', 'tta': 'l', 'ttg': 'l', 'tct': 's', 'tcc': 's', 'tca': 's',
'tc... | 2.25 | 2 |
python/eet/__init__.py | SidaZh/EET | 0 | 39096 | <gh_stars>0
from .fairseq import *
from .transformers import *
from .utils import *
from .pipelines import *
| 1.039063 | 1 |
examples/client_example.py | christian-oudard/AIOPyFix | 0 | 39097 | <gh_stars>0
import asyncio
from enum import Enum
import logging
import random
from aiopyfix.connection import ConnectionState, MessageDirection
from aiopyfix.client_connection import FIXClient
from aiopyfix.engine import FIXEngine
from aiopyfix.message import FIXMessage
class Side(Enum):
buy = 1
sell = 2
cl... | 2.53125 | 3 |
quantize-gym/gym/envs/robotics/fetch/pick_and_place.py | YunchuZhang/Visually-Grounded-Library-of-Behaviors-for-Generalizing-Manipulation-Across-Objects-Configurations- | 1 | 39098 | <filename>quantize-gym/gym/envs/robotics/fetch/pick_and_place.py<gh_stars>1-10
import os
from gym import utils
from gym.envs.robotics import fetch_env
# Ensure we get the path separator correct on windows
MODEL_XML_PATH = os.path.join('fetch', 'pick_and_place.xml')
class FetchPickAndPlaceEnv(fetch_env.FetchEnv, uti... | 2.09375 | 2 |
logic_inference_dataset/generate_sample_data.py | pedersor/google-research | 0 | 39099 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 2.640625 | 3 |