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 |
|---|---|---|---|---|---|---|
src/core/utils.py | saiblo/saiblo-local-judger | 4 | 12772151 | <gh_stars>1-10
def bytes2int(data: bytes) -> int:
return int.from_bytes(data, byteorder="big", signed=True)
def int2bytes(x: int) -> bytes:
return int.to_bytes(x, length=4, byteorder="big", signed=True)
| 2.71875 | 3 |
Python32/sounds.py | andersonsilvade/python_C | 0 | 12772152 | import pygame.mixer
sounds = pygame.mixer
sounds.init()
def espera_tocar(canal):
while canal.get_busy():
pass
s= sounds.Sound("heartbeat.wav")
espera_tocar(s.play())
s2 = sounds.Sound("buzz.wav")
espera_tocar(s2.play())
s3 = sounds.Sound("ohno.wav")
espera_tocar(s3.play())
s4 = sounds.Sound("carhorn.wav")... | 2.40625 | 2 |
setup.py | iNouvellie/social-network-rusa | 0 | 12772153 | <reponame>iNouvellie/social-network-rusa<filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
"""
@author: <NAME>
@contact: https://vk.com/python273
@license Apache License, Version 2.0, see LICENSE file
Copyright (C) 2017
"""
setup(
name='vk_api',
version='8.3.1'... | 1.398438 | 1 |
runner/job/run.py | perrette/runner | 2 | 12772154 | """Run model ensemble
The canonical form of `job run` is:
job run [OPTIONS] -- EXECUTABLE [OPTIONS]
where `EXECUTABLE` is your model executable or a command, followed by its
arguments. Note the `--` that separates `job run` arguments `OPTIONS` from the
executable. When there is no ambiguity in the command-line ... | 2.3125 | 2 |
7_snmp/code/discover.py | lluxury/P_U_S_A | 0 | 12772155 | <gh_stars>0
#!/usr/bin/env python
from processing import Process, Queue, Pool
import time
import subprocess
from IPy import IP
import sys
from snmp import Snmp
q = Queue()
oq = Queue()
#ips = IP("10.0.1.0/24")
ips = ["172.16.31.10", "172.16.17.32", "172.16.31.10","192.168.3.11",
"192.168.1.1"]
num_workers = 10
class ... | 2.515625 | 3 |
app.py | dpjmv/spotify-mode-percentage | 0 | 12772156 | <filename>app.py
import spotipy
import sys
import spotipy.util as util
import os
def connectToSpotify(username):
"""
Default constructor
:param username:
Username of the user to interact with.
:returns:
A spotipy.Spotify object that can then be used to interact
with the ... | 3.25 | 3 |
t_10_brief_tour_of_the_standard_library/t_10_8_dates_and_times/main.py | naokiur/Python-tutorial | 0 | 12772157 | from datetime import date
now = date.today()
print(now)
print(now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B"))
past = date(2003, 12, 2)
print(past)
print(past.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B"))
birthday = date(1964, 7, 31)
age = now - birthday
print(age.days)
| 4 | 4 |
intern/bale_mkt.py | zaqwes8811/smart-vocabulary-cards | 0 | 12772158 | # type-mkt: interfaces
"""
TODO(zaqwes): Move from here
Словарь макетов:
String - абстрактная строка
Int(int) - целое число
! Комментарии расставлять как показано
под именами классов и интерфейсов. Это используется при разборе
макета
Делемма:
Для Python тип не важен, для Java важен, как быть с ... | 2.734375 | 3 |
tests/communities/test_cli.py | lhenze/invenio-communities | 0 | 12772159 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 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.
"""Tests for the CLI."""
from faker import Faker
from invenio_communities.fixtures.... | 1.742188 | 2 |
microblog/accounts/migrations/0008_auto_20200929_2146.py | ShrayankM/Django-MicroBlog | 0 | 12772160 | <reponame>ShrayankM/Django-MicroBlog
# Generated by Django 3.1.1 on 2020-09-29 16:16
from django.db import migrations
import smartfields.fields
class Migration(migrations.Migration):
dependencies = [
('accounts', '0007_auto_20200927_0603'),
]
operations = [
migrations.AlterField(
... | 1.65625 | 2 |
user_interface/test/test_dakota_class.py | ukaea/ALC_UQ | 2 | 12772161 | from dakota_class import DakotaClass
from exceptions import *
import unittest
import xarray as xr
import numpy as np
import os
class TestDakotaClass(unittest.TestCase):
# Try and create an instance of the dakota class
def test_create_dakota_template(self):
my_dakota = DakotaClass()
s... | 2.609375 | 3 |
zope/MimeTypeItem.py | nuxeo-cps/zope2--PortalTransforms | 0 | 12772162 | <reponame>nuxeo-cps/zope2--PortalTransforms
from Acquisition import Implicit
from OFS.SimpleItem import Item
from AccessControl import ClassSecurityInfo
from Globals import Persistent, InitializeClass
try:
from Products.CMFCore.permissions import ManagePortal
except ImportError: # BBB: CMF 1.4
from Products.CMF... | 1.8125 | 2 |
testplan/exporters/testing/xml/__init__.py | Morgan-Stanley/Testplan | 0 | 12772163 | <gh_stars>0
"""
XML Export logic for test reports.
"""
import os
import pathlib
import shutil
import socket
from collections import Counter
from typing import Generator, List, Dict, Union
from lxml import etree
from lxml.etree import Element
from lxml.builder import E # pylint: disable=no-name-in-module
from testpl... | 2.40625 | 2 |
docs/_static/demos/io/DownloadMmtfFilesDemo.ipynb.py | sbliven/mmtf-pyspark | 59 | 12772164 |
# coding: utf-8
# # Download Mmtf Files Demo
#
# Example of downloading a list of PDB entries from [RCSB]("http://mmtf.rcsb.org")
#
# ## Imports
# In[9]:
from pyspark import SparkConf, SparkContext
from mmtfPyspark.io import mmtfReader
from mmtfPyspark.structureViewer import view_structure
# ## Configure Spark... | 2.34375 | 2 |
myo.py | hassanyf/myo-emg-python | 4 | 12772165 | <filename>myo.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 7 15:21:26 2018
@author: hassanyf and nabeelyousfi
"""
import pandas as pd
import keras
# Training and predicting EMG's from dataset
dataset = pd.read_csv('dataset.csv')
X = dataset.iloc[:, [0,1,2,3,4,5,6,7]].values
y = dataset.iloc[:, 8].values
# Enc... | 3.09375 | 3 |
src/explainer/task.py | saromanov/explainer | 0 | 12772166 | from typing import List
from parse import parse_explain
from db import explain, rows_count
from parse import Analyzer
from serializer import Serializer
class Task(Serializer):
''' defines query as a task
'''
def __init__(self, parent_title, title, query, *args, **kwargs):
self.query = query
... | 2.765625 | 3 |
scripts/webscraping/youtube/youtube_first_page_titles.py | iluxonchik/python-general-repo | 0 | 12772167 | from urllib.request import urlopen
from bs4 import BeautifulSoup
import sys, io
# Windows console uses the cp437 encoding, which only supports 256 characters,
# wich means that some unicode chars can't be rendered, so one quick fix is
# to escape those chars and print their actual code instead of rendering them.
# ba... | 3.125 | 3 |
src/main/migrations/0017_auto_20170625_1622.py | shashankmohabia/gymkhana-master | 1 | 12772168 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-25 10:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('oauth', '0002_auto_20170612_1258'),
('main', '0016_... | 1.710938 | 2 |
photos/admin.py | martinmandina/Photo-Gallery | 0 | 12772169 | <reponame>martinmandina/Photo-Gallery
from django.contrib import admin
from .models import Category,Location,Image,Photo
# Register your models here.
admin.site.register(Location)
admin.site.register(Category)
admin.site.register(Image)
admin.site.register(Photo)
| 1.40625 | 1 |
src/semantics/autotype_inferencer.py | RodroVMS/cool-compiler-2022 | 0 | 12772170 | <reponame>RodroVMS/cool-compiler-2022
from parsing.parsing_rules import p_param
import semantics.visitor as visitor
from parsing.ast import ArithmeticNode, AssignNode, AttrDeclarationNode, BlocksNode, CaseNode, CaseOptionNode, ClassDeclarationNode, ComparerNode, ComplementNode, ConditionalNode, EqualsNode, IsVoidNode, ... | 2.46875 | 2 |
agrspy/envspy-histaqi/discards/monurl.py | soonyenju/agrspy | 2 | 12772171 | # coding: utf-8
import json
import time
from datetime import datetime
from urllib.parse import urljoin
import requests
from bs4 import BeautifulSoup
from sylogger import logger
def main():
run(stop_date = "20131101", provs = ['江苏'])
def run(stop_date = "20181101", provs = []):
stop_date = datetime.strptime(stop_... | 2.9375 | 3 |
env/WritePolicyEnv.py | jeanqasaur/jeeves | 253 | 12772172 | <reponame>jeanqasaur/jeeves
import JeevesLib
# import fast.AST
# from collections import defaultdict
class WritePolicyEnv:
def __init__(self):
self.writers = {}
def mapPrimaryContext(self, ivar, ctxt):
self.writers[ivar] = ctxt
# This function associates a new set of write policies with a label.
def... | 2.765625 | 3 |
app/core/tests/utils.py | NhatHox23/nhat-recipe-backend | 0 | 12772173 | <reponame>NhatHox23/nhat-recipe-backend<filename>app/core/tests/utils.py
from django.contrib.auth import get_user_model
from recipe.models import Tag
def sample_user(email='<EMAIL>', password='<PASSWORD>'):
"""Helper function to help create user"""
user = get_user_model().objects.create_user(email=email, pass... | 2.328125 | 2 |
funcs_app.py | ds-suyog/python_flask_func_app | 0 | 12772174 | <filename>funcs_app.py
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def functions():
return render_template('my-form.html')
@app.route('/', methods=['POST'])
def my_form_post():
if request.form["submit"] == "submit":
import funcs
if request.form['factorial'] != ... | 2.859375 | 3 |
lib/timetype.py | nicciniamh/timelywall | 1 | 12772175 | <reponame>nicciniamh/timelywall<filename>lib/timetype.py<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Timely Wallpaper Changer
# Copyright 2017 <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 Licens... | 2.453125 | 2 |
umls/semantic_types.py | OHNLP/clinical-problem-standardization | 5 | 12772176 | '''
Utilities for processing semantic types
'''
import pkg_resources
lines = list(map(lambda x: x.split('|'), open(pkg_resources.resource_filename(__name__, 'SemanticTypes_2018AB.txt')).readlines()))
abbreviation_to_id = {x[0]: x[1] for x in lines}
id_to_abbreviation = {x[1]: x[0] for x in lines}
groups = {line[2]:... | 2.921875 | 3 |
AWSPythonCode/PurgeS3Bucket.py | wesleywh/EMI_Servers | 0 | 12772177 | <filename>AWSPythonCode/PurgeS3Bucket.py
import argparse
import boto3
# Install boto3: pip install boto3 --target=C:\path\to\dir
parser = argparse.ArgumentParser(description='Deletes everything in a bucket including versions.')
parser.add_argument('--bucket', dest='bucket', help='The S3 bucket name to compeltely purge.... | 2.53125 | 3 |
ch6/tablePrinter.py | ecmartz/python-practice | 0 | 12772178 | #!/usr/bin/python3.4
tableData = [['apples','oranges','cherries','bananas'],
['Alice','Bob','Carol','David'],
['dogs','cats','moose','goose']]
# Per the hint
colWidth = [0] * len(tableData)
# Who knew you had to transpose this list of lists
def matrixTranspose( matrix ):
if not matrix: ... | 3.8125 | 4 |
app/models.py | faylau/microblog | 0 | 12772179 | <reponame>faylau/microblog
#coding=utf-8
from hashlib import md5
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, SmallInteger, DateTime, \
ForeignKey, create_engine
from sqlalchemy.orm import relationship, scoped_session, sessionmaker
from app import app
from... | 2.390625 | 2 |
src/pkgcore/repository/prototype.py | thesamesam/pkgcore | 0 | 12772180 | """
base repository template
"""
__all__ = (
"CategoryIterValLazyDict", "PackageMapping", "VersionMapping", "tree"
)
import os
from snakeoil.klass import jit_attr
from snakeoil.mappings import DictMixin, LazyValDict
from snakeoil.osutils import pjoin
from snakeoil.sequences import iflatten_instance
from ..ebuil... | 1.65625 | 2 |
ASTStructure.py | PauloBarrantes/Niark | 1 | 12772181 | class Niark:
def __init__(self):
self.statements = []
def addStatement(self, statement):
self.statements.insert(0,statement)
def printObject(self, tabs):
for x in range (0, len(self.statements)):
self.statements[x].printObject(tabs)
#####################################... | 3.546875 | 4 |
qsr_lib/src/qsrlib_qsrs/qsr_rcc2_rectangle_bounding_boxes_2d.py | yianni/rtd-dbg | 0 | 12772182 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from qsrlib_qsrs.qsr_rcc_abstractclass import QSR_RCC_Abstractclass
class QSR_RCC2_Rectangle_Bounding_Boxes_2D(QSR_RCC_Abstractclass):
"""RCC2 relations.
# 'dc' bb1 is disconnected from bb2
# 'c' bb1 is connected ... | 2.765625 | 3 |
tests.live/Python/test_live.py | Bradben/iqsharp | 115 | 12772183 | #!/bin/env python
# -*- coding: utf-8 -*-
##
# test_live.py: Tests Azure Quantum functionality Live.
##
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
##
## IMPORTS ##
import pytest
import warnings
## TESTS ##
def connect():
import qsharp.azure
return qsharp.azure.connect(
... | 2.234375 | 2 |
addresses/hinsdale.py | johncoleman83/attom_python_client | 0 | 12772184 | #!/usr/bin/env python3
"""
ATTOM API
https://api.developer.attomdata.com
"""
HINSDALE = "HINSDALE, IL"
MADISON_HINSDALE = {}
HOMES = {
"216 S MADISON ST": HINSDALE,
"607 S ADAMS ST": HINSDALE,
"428 MINNEOLA ST": HINSDALE,
"600 S BRUNER ST": HINSDALE,
"637 S BRUNER ST": HINSDALE,
"142 S STOUGH ST": HINSDA... | 1.945313 | 2 |
wordle_assistant.py | ckatkinson/WordleAssistant | 0 | 12772185 | #!/usr/bin/python3
from typing import List
from src.word_importer import import_word_list
from src.scoring import word_scores
from src.wordle_filter import filter_from_word_info
class WordleAssistant:
"""
This class asks for input when initialized and then packages the suggestion mechanism.
"""
def ... | 3.84375 | 4 |
pyhp/cmd.py | cr/pyHP49 | 1 | 12772186 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import protocol
import hpstr
#http://www.hpcalc.org/details.php?id=5910
objtypes = {
0x3329: ("DOREAL","real (%) 153."),
0x7729: ("DOCMP","complex (C%) (3.,4.)"),
0x2C2A: ("DOCSTR","string ($) 'Hello'"),
0xE829: ("DOARRY","array ( [] ) [3. 4.]"),
... | 2.078125 | 2 |
tests/node/test_node_async.py | vladr11/graphql-relay-py | 0 | 12772187 | from typing import NamedTuple
from pytest import mark
from graphql import (
graphql,
GraphQLField,
GraphQLID,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
GraphQLString,
)
from graphql_relay import node_definitions
class User(NamedTuple):
id: str
name: str
user_data = [Us... | 2.34375 | 2 |
mars/lib/nvutils.py | sighingnow/mars | 0 | 12772188 | # -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# 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 require... | 1.859375 | 2 |
modred/tests/testltigalerkinproj.py | pythonpadawanEXE/modred | 55 | 12772189 | #!/usr/bin/env python
"""Test ltigalerkinproj module"""
import unittest
import os
from os.path import join
from shutil import rmtree
import numpy as np
from modred import ltigalerkinproj as lgp, parallel, util
from modred import util
from modred.py2to3 import range
from modred.vectors import VecHandlePickle
<EMAIL>... | 2.390625 | 2 |
bauxite/http/client.py | vcokltfre/bauxite | 1 | 12772190 | from __future__ import annotations
from asyncio import create_task, sleep
from collections import defaultdict
from dataclasses import dataclass
from json import dumps
from typing import Any, Awaitable, Callable, Mapping, Optional, Sequence, Type, Union
from aiohttp import BasicAuth, ClientResponse, ClientSession, For... | 1.921875 | 2 |
tests/_apis/test_BaseApi.py | physicsninja/Riot-Watcher | 0 | 12772191 | <filename>tests/_apis/test_BaseApi.py
import unittest
import sys
if sys.version_info > (3, 0):
from unittest.mock import MagicMock
from unittest import mock
else:
from mock import MagicMock
import mock
from riotwatcher._apis import BaseApi
class BaseApiTestCase(unittest.TestCase):
def setUp... | 2.3125 | 2 |
examples/threads.py | TankerHQ/python-cli-ui | 30 | 12772192 | import threading
import time
from threading import Thread
import cli_ui
def long_computation():
# Simulates a long computation
time.sleep(0.6)
def count_down(lock, start):
x = start
while x >= 0:
with lock:
# Note: the sleeps are here so that we are more likely to
# ... | 3.421875 | 3 |
end_to_end/Generate_Chains_old.py | Bharathgc/Coreference-resolution | 1 | 12772193 |
folder_nm='end_to_end'
coref_path="/home/raj/"+folder_nm+"/output/coreferent_pairs/output2.txt"
chains_path="/home/raj/"+folder_nm+"/output/chains/chains.txt"
f1=open(chains_path,"w+")
def linear_search(obj, item, start=0):
for l in range(start, len(obj)):
if obj[l] == item:
return l
return... | 2.765625 | 3 |
commandHandler.py | NightKev/Renol-IRC | 2 | 12772194 | <filename>commandHandler.py
import imp, os
import Queue
import logging
from time import strftime
from timeit import default_timer
from datetime import datetime
import centralizedThreading
from BotEvents import TimerEvent, MsgEvent, StandardEvent
from IRC_registration import trackVerification
from CommandHelp import H... | 2.265625 | 2 |
api/urls.py | gheyderov/E-commerce-website | 0 | 12772195 | from os import name
from django.db import router
from django.urls import path
from django.urls.conf import include
from api.views.core_views import SubscribeAPIView
from api.views.order_views import BasketItemDeleteAPIView, BasketView, WishlistAPIView, WishlistDeleteAPIView
from api.views.product_views import ProductAP... | 2 | 2 |
tests/testxy.py | parsotat/swiftbat_python | 5 | 12772196 | <reponame>parsotat/swiftbat_python
import unittest
import swiftbat
import numpy as np
from pathlib import Path
class TestXY(unittest.TestCase):
def getsample(self):
"""
Test data from BAT data
from astropy.io import fits
d = fits.getdata('/tmp/sw01090661000bevshto_uf.evt.gz')
... | 2.421875 | 2 |
bsadiscord/data/sayings.py | perkinsms/bsadiscord | 0 | 12772197 | <reponame>perkinsms/bsadiscord<filename>bsadiscord/data/sayings.py<gh_stars>0
SCOUTOATH = '''
On my honor, I will do my best
to do my duty to God and my country
to obey the Scout Law
to help other people at all times
to keep myself physically strong, mentally awake and morally straight.
'''
SCOUTLAW = '''
A scout is:
... | 1.898438 | 2 |
src/solidityobf/transformations/modify_data_flow_1.py | ZhouBoXiao/SolidityObfuscator | 2 | 12772198 | from solidityobf.common.classes import String,PropertyName,Ident,Expr,VarDeclaration,Assignment,Statements
from solidityobf.common.tree_walker import walker
from solidityobf.common.common import deepcopy,is_functioncall_inside
from solidityobf.common.finder import get_all_ident,get_all_upper_statements_and_pos,get_uppe... | 2.265625 | 2 |
robber/matchers/called.py | pylipp/robber.py | 23 | 12772199 | from robber import expect
from robber.explanation import Explanation
from robber.matchers.base import Base
class Called(Base):
"""
expect(mock).to.be.called()
"""
def matches(self):
try:
return self.actual.called
except AttributeError:
raise TypeError('{actual}... | 2.640625 | 3 |
tools/ffmpeg/playmany.py | AnantTiwari-Naman/pyglet | 1,160 | 12772200 | <filename>tools/ffmpeg/playmany.py<gh_stars>1000+
"""
Usage
playmany.py
Uses media_player to play a sequence of samples and record debug info
A configuration must be active, see command configure.py
If the active configuration has disallowed dbg overwrites it will do nothing.
If a playlist was provide... | 2.046875 | 2 |
chapt05/shadow.py | ohlogic/PythonOpenGLSuperBible4Glut | 0 | 12772201 | <reponame>ohlogic/PythonOpenGLSuperBible4Glut
#!/usr/bin/python3
# Demonstrates simple planar shadows
# <NAME>
# <EMAIL>
#
# based heavily on shadow.cpp
# OpenGL SuperBible
# Program by <NAME>.
import math
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
ESCAPE = b'\033'
... | 2.59375 | 3 |
code/__init__.py | deekay2310/SE21_HW2B_Group6 | 16 | 12772202 | from math import *
| 1.179688 | 1 |
dataset.py | yokinglou/CorresPondenceNet | 1 | 12772203 | import os
import h5py
import torch
import numpy as np
import scipy
import json
class CorresPondenceNet(torch.utils.data.Dataset):
def __init__(self, cfg, flag='train'):
super().__init__()
with open(os.path.join(cfg['data_path'], 'name2id.json'), 'r') as f:
self.name2id = json.load(f)
... | 2.046875 | 2 |
libs/sol-REL-1.7.5.0/tests/test_file.py | realms-team/solmanager | 0 | 12772204 | <filename>libs/sol-REL-1.7.5.0/tests/test_file.py
from .context import sol
import os
import random
import pytest
# ============================ defines ===============================
FILENAME = 'temp_test_file.sol'
EXAMPLE_MAC = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]
# ============================ fixtu... | 2.078125 | 2 |
bind9/main.py | tuimac/bind9 | 0 | 12772205 | <filename>bind9/main.py<gh_stars>0
#!/usr/bin/env python3
import os
import path
import logging
import traceback
import yaml
import argparse
import subprocess
from .config.namedConfig import NamedConfig
logger = logging.getLogger('bind9')
def importConfig(path):
try:
path = os.path.expanduser(path)
... | 2.453125 | 2 |
game_settings.py | Mibblez/a-star-with-python | 0 | 12772206 | # Colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREY = (140, 140, 140)
CYAN = (0, 255, 255)
DARK_CYAN = (0, 150, 150)
ORANGE = (255, 165, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
| 1.90625 | 2 |
singleton/print_version.py | Tomvictor/python-design-patterns | 0 | 12772207 | <reponame>Tomvictor/python-design-patterns
import sys
print(sys.version) | 1.34375 | 1 |
openslides_backend/action/motion_category/__init__.py | reiterl/openslides-backend | 0 | 12772208 | from . import create_update_delete, sort, sort_motions_in_categories # noqa
| 0.960938 | 1 |
tap_amazon_advertising/streams/__init__.py | goes-funky/tap-amazon-advertising | 2 | 12772209 | <filename>tap_amazon_advertising/streams/__init__.py
from tap_amazon_advertising.streams.profiles import ProfilesStream
from tap_amazon_advertising.streams.portfolios import PortfoliosStream
from tap_amazon_advertising.streams.sponsored_products_campaigns import SponsoredProductsCampaignsStream
from tap_amazon_adverti... | 1.296875 | 1 |
trainer.py | wannieman98/RandWireNN | 0 | 12772210 |
import os
import time
import torch
import random
import numpy as np
from tqdm import tqdm
import torch.nn as nn
from util import epoch_time
import torch.optim as optim
from model.neural_network import RandomlyWiredNeuralNetwork
from data.data_util import fetch_dataloader, test_voc, test_imagenet
SEED = 981126
random... | 2.109375 | 2 |
src/glod/db/db_column_type_map.py | gordon-elliott/glod | 0 | 12772211 | <gh_stars>0
__copyright__ = 'Copyright(c) <NAME> 2017'
"""
"""
from sqlalchemy import (
Enum,
)
from a_tuin.db.mapper import DB_COLUMN_TYPE_MAP
from glod.model.account import AccountStatusField, AccountStatus
from glod.model.fund import FundRestrictionField, FundRestriction
from glod.model.nominal_account imp... | 1.773438 | 2 |
lib/experiment.py | wonderit/aptos-retinopathy-detection | 0 | 12772212 | from copy import deepcopy
from datetime import datetime
from os import makedirs, remove
from os.path import join, isfile, isdir, dirname
import numpy as np
import torch
def append_to_file(file, string):
dir_nm = dirname(file)
if len(dir_nm) > 0 and not isdir(dir_nm):
makedirs(dir_nm)
with open(fi... | 2.515625 | 3 |
src/ralph/discovery/openstack.py | quamilek/ralph | 0 | 12772213 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import urllib
import urllib2
import json
import datetime
class Error(Exception):
pass
class OpenStack(object):
def __init__(self, url... | 2.484375 | 2 |
src/snap_to_bucket/s3_handler.py | siemens/snap-to-bucket | 5 | 12772214 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
SPDX-FileCopyrightText: Siemens AG, 2020 <NAME> <<EMAIL>>
SPDX-License-Identifier: MIT
"""
__author__ = 'Siemens AG'
import gc
import os
import sys
import time
import base64
import hashlib
import threading
from datetime import datetime
from subprocess import PIPE, P... | 2.109375 | 2 |
env/lib/python3.8/site-packages/unidecode/x016.py | avdhari/enigma | 48 | 12772215 | <reponame>avdhari/enigma
data = (
'kka', # 0x00
'kk', # 0x01
'nu', # 0x02
'no', # 0x03
'ne', # 0x04
'nee', # 0x05
'ni', # 0x06
'na', # 0x07
'mu', # 0x08
'mo', # 0x09
'me', # 0x0a
'mee', # 0x0b
'mi', # 0x0c
'ma', # 0x0d
'yu', # 0x0e
'yo', # 0x0f
'ye', # 0x10
'yee', #... | 1.351563 | 1 |
tests/integration/server/test_Server_join.py | JSchneidler/python-irc | 0 | 12772216 | <gh_stars>0
from socket import socket
from server.Server import Server
from .utils import createClient, readLine, registerClient, readJoin
def test_Server_join(client: socket):
registerClient(client)
client.sendall(b"JOIN #chan\r\n")
responses = readJoin(client)
expectedResponses = [
":tes... | 2.78125 | 3 |
board.py | Blubmin/adversarial_tower_defense | 0 | 12772217 | import pygame
import math
from functools import reduce
from tower import Tower
from unit import Unit
class BoardState:
def __init__(self, board):
self.unitsDeployed = len(board._units) + board._unitsDestroyed + board._unitsThatReachedGoal
self.towersDeployed = 0
self.towersInUpperLeft = 0
... | 3.109375 | 3 |
Part_3_advanced/m17_tests_II/stub_mock/example_3/galactic_systems/person.py | Mikma03/InfoShareacademy_Python_Courses | 0 | 12772218 | from dataclasses import dataclass
@dataclass
class Person:
name: str
height: int
mass: int
| 2.34375 | 2 |
main.py | itaouil/Shape-Recognition-Challenge | 0 | 12772219 | <reponame>itaouil/Shape-Recognition-Challenge
"""
Script responsible to read-in
the input image to be counted
and carry out the processing,
detection and counting logics.
"""
# Imports
import cv2
import argparse
import numpy as np
from scripts import ShapeRecognition
# Detector object
sr = ShapeRecogn... | 3.171875 | 3 |
core/utils/render_utils.py | hyunynim/DIST-Renderer | 176 | 12772220 | import trimesh
import numpy as np
import cv2
import copy
import pickle
import torch
import pdb
def depth2normal(depth, f_pix_x, f_pix_y=None):
'''
To compute a normal map from the depth map
Input:
- depth: torch.Tensor (H, W)
- f_pix_x: K[0, 0]
- f_pix_y: K[1, 1]
Return:
- normal: t... | 2.453125 | 2 |
programming-laboratory-I/17gp/mais_elementos.py | MisaelAugusto/computer-science | 0 | 12772221 | <reponame>MisaelAugusto/computer-science<filename>programming-laboratory-I/17gp/mais_elementos.py
# coding: utf-8
# Aluno: <NAME>
# Matrícula: 117110525
# Problema: Conjunto com mais elementos
tamanho = 0
tamanhos = []
while True:
numero = raw_input()
if numero == "fim":
break
else:
if int(numero) >= 0:
tama... | 3.703125 | 4 |
src/01_run-yamnet_covid19_20-03-30.py | lostanlen/sonyc-yamnet | 0 | 12772222 | <filename>src/01_run-yamnet_covid19_20-03-30.py
import sys
import datetime
import glob
import h5py
import numpy as np
import os
import tensorflow as tf
import time
src_dir = os.path.dirname(os.path.abspath(__file__))
git_dir = os.path.split(src_dir)[0]
yamnet_dir = os.path.join(git_dir, "yamnet")
sys.path.append(yamn... | 2.59375 | 3 |
regel/converter.py | heijp06/regel | 0 | 12772223 | <reponame>heijp06/regel<filename>regel/converter.py
class Converter:
APPLICATION_SINGLE = 0
APPLICATION_MANY = 1
def __init__(self, text, application):
self.text = text
self.application = application
self._function = None
def __repr__(self):
colons = ":" if self.app... | 2.78125 | 3 |
venv/checkers.py | JamesG3/Checkers_AI | 0 | 12772224 | import display
import board
import robot
import config as conf
import sys
import pygame
from pygame.locals import *
import time
class Checkers:
def __init__(self):
self.display = display.Display()
self.board = board.Board()
self.set_difficulty = 0
self.turn = None
self.valid_moves = []
self.curr_piec... | 3.296875 | 3 |
ch11_Django/myproject/poster/models.py | Nickhool/core-python | 1 | 12772225 | <reponame>Nickhool/core-python
from django.db import models
# Create your models here.
from django.db import models
class Tweet(models.Model):
text = models.CharField(max_length=140)
author_email = models.CharField(max_length=200)
created_at = models.DateTimeField(auto_now_add=True)
published_at = mo... | 2.578125 | 3 |
python/100-days-of-code/programs/day_22/score_board.py | star-junk/references | 0 | 12772226 | from turtle import Turtle
class ScoreBoard(Turtle):
def __init__(self, x: int=0, y: int=0):
super().__init__()
self.hideturtle()
self.penup()
self.color('white')
self.score = 0
self.setpos((x, y))
self.write_score()
def write_score(self):
... | 3.6875 | 4 |
pytorch_lightning/strategies/bagua.py | neptune-ml/pytorch-lightning | 0 | 12772227 | <reponame>neptune-ml/pytorch-lightning<gh_stars>0
import logging
import os
from typing import Any, Dict, List, Optional, Union
import torch
from torch.nn import Module
import pytorch_lightning as pl
from pytorch_lightning.overrides.base import (
_LightningModuleWrapperBase,
_LightningPrecisionModuleWrapperBas... | 1.851563 | 2 |
polling_stations/apps/data_collection/management/commands/import_hyndburn.py | mtravis/UK-Polling-Stations | 0 | 12772228 | <gh_stars>0
from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "E07000120"
addresses_name = "local.2018-05-03/Version 1/polling_station_export-2018-02-16.csv"
stations_name = "local.2018-05-03/Version 1/polling_station_export-2018-0... | 1.578125 | 2 |
packages/core/minos-microservice-aggregate/minos/aggregate/transactions/repositories/abc.py | minos-framework/minos-python | 247 | 12772229 | <gh_stars>100-1000
from __future__ import (
annotations,
)
from abc import (
ABC,
abstractmethod,
)
from datetime import (
datetime,
)
from typing import (
AsyncIterator,
Optional,
)
from uuid import (
UUID,
)
from minos.common import (
Inject,
Injectable,
Lock,
LockPool,
... | 2.28125 | 2 |
allianceutils/util/__init__.py | AllianceSoftware/alliance-django-utils | 2 | 12772230 | from pathlib import Path
from typing import Callable
from typing import Iterable
from typing import Tuple
from typing import Union
from django.conf import settings
from django.utils.autoreload import autoreload_started
from django.utils.autoreload import StatReloader
from .camel_case import camel_to_underscore
from .... | 1.9375 | 2 |
ci/report/final_result.py | PradeepKiruvale/localworkflow | 6 | 12772231 | #!/bin/python3
"""Parse final xml and return an error if there are failures.
"""
import sys
from xml.dom.minidom import parse
dom = parse(sys.argv[1])
errors = 0
failures = 0
for nodes in dom.childNodes:
l = nodes.attributes.length
for node in range(l):
attr = nodes.attributes.item(node)
... | 3.484375 | 3 |
tests/clients/settings/test_org_settings.py | PixelogicDev/py42 | 0 | 12772232 | <reponame>PixelogicDev/py42<gh_stars>0
import json
from copy import deepcopy
import pytest
from tests.clients.conftest import param
from tests.clients.conftest import PHOTOS_REGEX
from tests.clients.conftest import PICTURES_REGEX
from tests.clients.conftest import TEST_ADDED_EXCLUDED_PATH
from tests.clients.conftest i... | 1.820313 | 2 |
Qianhui_Liang_1.001_final/qh_yelp/naive_bayes.py | lqh-0514/1.01_final_foodie_mate | 0 | 12772233 | <filename>Qianhui_Liang_1.001_final/qh_yelp/naive_bayes.py<gh_stars>0
# coding: utf-8
# In[1]:
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 23 20:13:10 2018
@author: qianhuil
"""
import pymongo
from pymongo import MongoClient
import json
import nltk
from nltk.corpus import stopwords
import matplotlib.pyplot as p... | 2.546875 | 3 |
tests/data/pattern_matching_extras.py | timsampsoncujo/black | 2 | 12772234 | import match
match something:
case [a as b]:
print(b)
case [a as b, c, d, e as f]:
print(f)
case Point(a as b):
print(b)
case Point(int() as x, int() as y):
print(x, y)
match = 1
case: int = re.match(something)
match re.match(case):
case type("match", match):
... | 3.34375 | 3 |
Python3-functions/write_into_local_file.py | ipetel/code-snippets | 1 | 12772235 | <reponame>ipetel/code-snippets<filename>Python3-functions/write_into_local_file.py<gh_stars>1-10
"""
# .___ .___ __________ __ .__
# | | __| _/____ ____ \______ \ _____/ |_ ____ | |
# | |/ __ |\__ \ / \ | ___// __ \ __\/ __ \| ... | 2.953125 | 3 |
providers/twitter.py | goru/oauth2-proxy.py | 0 | 12772236 | import logging
import requests
logger = logging.getLogger(__name__)
# https://developer.twitter.com/en/docs/authentication/oauth-2-0/user-access-token
class TwitterProvider:
def __init__(self, configs):
self.client_id = configs['client_id']
self.redirect_uri = configs['redirect_uri']
... | 2.765625 | 3 |
SmartObjectFramework/ObjectService/rdflib/term.py | OSIOT/OBSOLETE-IoT-Toolkit | 1 | 12772237 | """
This module defines the different types of terms. Terms are the kinds of
objects that can appear in a quoted/asserted triple. This includes those
that are core to RDF:
* Blank Nodes
* URI References
* Literals (which consist of a literal value,datatype and language tag)
Those that extend the RDF model into N3:
... | 2.546875 | 3 |
pydax/_schema.py | SSaishruthi/pydax | 0 | 12772238 | <filename>pydax/_schema.py
#
# Copyright 2020 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 2.0625 | 2 |
examples/01_mask_xt.py | chris-carbonell/safecracker | 0 | 12772239 | # safecracker
from safecracker import safecracker as sc
from safecracker.safe import zip as safe
from safecracker.tools import mask as sct
from examples import testing
# get safe
safe = safe.Safe("examples/safe/easy.zip")
# get safecracker
pwg = sct.PasswordGenerator("-d", max_len=3) # just digits
safecracker = sc.S... | 2.40625 | 2 |
tests/jj/fraunhofer/test_estimation.py | ShabaniLab/shabanipy | 6 | 12772240 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2020 by ShabaniPy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT license.
#
# The full license is in the file LICENCE, distributed with this software.
# ----------------... | 2.140625 | 2 |
setup.py | felix-last/kmeans_smote | 73 | 12772241 | <reponame>felix-last/kmeans_smote<filename>setup.py
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname), encoding='utf-8').read()
tests_require = [
'pytest>=4.2.1,<4.3',
'pytest-cov>=2.6.1,<2.7',
'codecov>=2.0.15,<2.1'
],
setup(
name... | 1.414063 | 1 |
2.4 2-Sum.py | INOS-soft/MOmmentum-SECList | 0 | 12772242 | <reponame>INOS-soft/MOmmentum-SECList<gh_stars>0
"""
1.Question 1
The goal of this problem is to implement a variant of the 2-SUM algorithm covered in this week's lectures.
The file (2sum.txt) contains 1 million integers, both positive and negative (there might be some repetitions!).This is your array of integers,... | 3.421875 | 3 |
config.py | Japjappedulap/InfoarenaToGithub | 3 | 12772243 | import os
username = os.environ['USER_NAME']
sources_directory = os.environ['SOURCE_DIRECTORY']
overwrite_flag = True if os.environ['OVERWRITE_FLAG'] == 'true' else False
# print(type(username), username)
# print(type(sources_directory), sources_directory)
# print(type(overwrite_flag), overwrite_flag)
# You shouldn'... | 2.34375 | 2 |
archive/nexus-api-v2/API/Development/HTML/Interface.py | cloud-hybrid/delta | 0 | 12772244 | <gh_stars>0
# import asyncio
# import dataclasses
# import os
# import ssl
#
# __module__ = __name__
#
# import botocore.exceptions
#
# from fastapi import HTTPException
#
# from . import *
#
# import API.ASGI.Authentication.Token as Token
#
# from starlette.responses import HTMLResponse
#
# # =========================... | 1.757813 | 2 |
tests/test_vcs_get_set_cmap_colorcell.py | scottwittenburg/vcs | 11 | 12772245 | <filename>tests/test_vcs_get_set_cmap_colorcell.py
import vcs
import unittest
class TestVCSCMAP(unittest.TestCase):
def testGetSetCmapColorcell(self):
x = vcs.init()
gm = x.createboxfill()
cmap = x.createcolormap()
rgb = cmap.getcolorcell(25)
self.assertEqual(rgb, [28., ... | 2.46875 | 2 |
peeringdb_server/client_adaptor/backend.py | gordon-shumway-net/peeringdb | 0 | 12772246 | import re
from collections import defaultdict
from django.db.models import OneToOneRel
from django.core.exceptions import ValidationError
from django.conf import settings
from django.db import IntegrityError
from peeringdb import resource
import peeringdb_server.models as models
from django_peeringdb.client_adapto... | 2.078125 | 2 |
src/python/dxpy/utils/thread_pool.py | psung/dx-toolkit | 0 | 12772247 | # Copyright (C) 2013-2014 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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.a... | 1.757813 | 2 |
src/exec/__init__.py | feimaomiao/PWDS | 2 | 12772248 | <gh_stars>1-10
from .alterPrefs import *
from .enc import *
from .funcs import *
from .pwd import *
from .userClass import * | 1.21875 | 1 |
src/junk/1DCNN_BDLSTM.py | spil3141/Reseach-2-Malware-Detection-using-1D-CNN-and-RNN | 1 | 12772249 | <reponame>spil3141/Reseach-2-Malware-Detection-using-1D-CNN-and-RNN<gh_stars>1-10
"""#### Importting library ###"""
import numpy
import matplotlib.pyplot as plt
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Reshape, LSTM, Bidirectional
from tensorflow.ke... | 2.109375 | 2 |
tests/googl/test_googl_link.py | goldsborough/lnk | 3 | 12772250 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import ecstasy
import oauth2client.file
import pyperclip
import pytest
import requests
import threading
try:
from Queue import Queue
except ImportError:
from queue import Queue
from collections import namedtuple
import tests.paths
import lnk.googl.link
VERSION = 1
KE... | 2.203125 | 2 |