max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/it/test_docker_image_tag.py | gfi-centre-ouest/docker-devbox-ddb | 4 | 11700 | <filename>tests/it/test_docker_image_tag.py
import os
import zipfile
import yaml
from dotty_dict import Dotty
from pytest_mock import MockerFixture
from ddb.__main__ import main
from ddb.config import Config
from ddb.feature.version import is_git_repository
class TestDockerImageTag:
def test_image_tag_from_git_... | <filename>tests/it/test_docker_image_tag.py
import os
import zipfile
import yaml
from dotty_dict import Dotty
from pytest_mock import MockerFixture
from ddb.__main__ import main
from ddb.config import Config
from ddb.feature.version import is_git_repository
class TestDockerImageTag:
def test_image_tag_from_git_... | none | 1 | 2.150946 | 2 | |
bin/zeisel.py | bendemeo/ample | 0 | 11701 | import numpy as np
import os
from scanorama import *
from scipy.sparse import vstack
from process import load_names
from experiments import *
from utils import *
NAMESPACE = 'zeisel'
METHOD = 'svd'
DIMRED = 100
data_names = [
'data/mouse_brain/zeisel/amygdala',
'data/mouse_brain/zeisel/cerebellum',
'data... | import numpy as np
import os
from scanorama import *
from scipy.sparse import vstack
from process import load_names
from experiments import *
from utils import *
NAMESPACE = 'zeisel'
METHOD = 'svd'
DIMRED = 100
data_names = [
'data/mouse_brain/zeisel/amygdala',
'data/mouse_brain/zeisel/cerebellum',
'data... | en | 0.263906 | #samp_idx = gs(X_dimred, 20000, replace=False) #samp_idx = uniform(X_dimred, 20000, replace=False) #from anndata import AnnData #import scanpy.api as sc #adata = AnnData(X=X_dimred[samp_idx, :]) #sc.pp.neighbors(adata, use_rep='X') #sc.tl.louvain(adata, resolution=1.5, key_added='louvain') # #louv_labels = np.array(ada... | 2.072634 | 2 |
cogitare/monitor/workers/system_usage.py | cogitare-ai/cogitare | 90 | 11702 | <filename>cogitare/monitor/workers/system_usage.py
from threading import Thread
import psutil
import time
class SystemUsage(Thread):
def __init__(self, callback, *args, **kwargs):
super(SystemUsage, self).__init__(daemon=True)
self.interval = 1
self.enabled = False
self.callback =... | <filename>cogitare/monitor/workers/system_usage.py
from threading import Thread
import psutil
import time
class SystemUsage(Thread):
def __init__(self, callback, *args, **kwargs):
super(SystemUsage, self).__init__(daemon=True)
self.interval = 1
self.enabled = False
self.callback =... | none | 1 | 2.695848 | 3 | |
test/worker/net.py | ameserole/Naumachia | 0 | 11703 | import fcntl
import os
import socket
import struct
import warnings
import subprocess
import logging
import base64
logger = logging.getLogger(__name__)
# Dummy socket used for fcntl functions
_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
class AddrMeta(type):
@property
def maxvalue(cls):
... | import fcntl
import os
import socket
import struct
import warnings
import subprocess
import logging
import base64
logger = logging.getLogger(__name__)
# Dummy socket used for fcntl functions
_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
class AddrMeta(type):
@property
def maxvalue(cls):
... | en | 0.705377 | # Dummy socket used for fcntl functions # Operations # Conversions # SIOCGIFADDR # SIOCGIFNETMASK # SIOCGIFHWADDR # None is special to indicate the option have no value | 2.463131 | 2 |
kunrei.py | kosugi/alfred.romanizer | 0 | 11704 | # -*- coding: utf-8 -*-
basic_table = dict(map(lambda s: s.split(u'\t'), u'''
あ a
い i
う u
え e
お o
か ka
き ki
く ku
け ke
こ ko
さ sa
し si
す su
せ se
そ so
た ta
ち ti
つ tu
て te
と to
な na
に ni
ぬ nu
ね ne
の no
は ha
ひ hi
ふ hu
へ he
ほ ho
ま ma
み mi
む mu
め me
も mo
や ya
ゆ yu
よ yo
ら ra
り ri
る ru
れ re
ろ ro
わ wa
を wo
ぁ a
ぃ i
ぅ u
ぇ e
ぉ o
が... | # -*- coding: utf-8 -*-
basic_table = dict(map(lambda s: s.split(u'\t'), u'''
あ a
い i
う u
え e
お o
か ka
き ki
く ku
け ke
こ ko
さ sa
し si
す su
せ se
そ so
た ta
ち ti
つ tu
て te
と to
な na
に ni
ぬ nu
ね ne
の no
は ha
ひ hi
ふ hu
へ he
ほ ho
ま ma
み mi
む mu
め me
も mo
や ya
ゆ yu
よ yo
ら ra
り ri
る ru
れ re
ろ ro
わ wa
を wo
ぁ a
ぃ i
ぅ u
ぇ e
ぉ o
が... | ja | 0.789948 | # -*- coding: utf-8 -*- あ a い i う u え e お o か ka き ki く ku け ke こ ko さ sa し si す su せ se そ so た ta ち ti つ tu て te と to な na に ni ぬ nu ね ne の no は ha ひ hi ふ hu へ he ほ ho ま ma み mi む mu め me も mo や ya ゆ yu よ yo ら ra り ri る ru れ re ろ ro わ wa を wo ぁ a ぃ i ぅ u ぇ e ぉ o が ga ぎ gi ぐ gu げ ge ご go ざ za じ zi ず zu ぜ ze ぞ zo だ da ぢ... | 2.463296 | 2 |
tests/test_utils.py | loganthomas/turkey-bowl | 0 | 11705 | <reponame>loganthomas/turkey-bowl<filename>tests/test_utils.py
"""
Unit tests for utils.py
"""
# Standard libraries
import json
from pathlib import Path
# Third-party libraries
import pytest
# Local libraries
from turkey_bowl import utils
@pytest.mark.freeze_time
@pytest.mark.parametrize(
"frozen_date, expected... | """
Unit tests for utils.py
"""
# Standard libraries
import json
from pathlib import Path
# Third-party libraries
import pytest
# Local libraries
from turkey_bowl import utils
@pytest.mark.freeze_time
@pytest.mark.parametrize(
"frozen_date, expected",
[
("2010-09-09", 2010),
("2011-09-08", 2... | en | 0.602011 | Unit tests for utils.py # Standard libraries # Third-party libraries # Local libraries Use pytest-freezegun to freeze dates and check year. # Setup # Exercise # Verify # Cleanup - none necessary # Setup # Exercise # non-existent prior to write # Verify # Cleanup - none necessary # Setup # Exercise # existent prior to l... | 2.536425 | 3 |
regtests/webclgl/call_external_method.py | bpmbank/PythonJS | 319 | 11706 | <filename>regtests/webclgl/call_external_method.py
"""external method"""
class myclass:
def __init__(self, i):
self.index = i
def get_index(self):
return self.index
def run(self, n):
self.intarray = new(Int16Array(n))
self.intarray[ self.index ] = 99
@returns( array=n )
@gpu.main
def gpufunc():
... | <filename>regtests/webclgl/call_external_method.py
"""external method"""
class myclass:
def __init__(self, i):
self.index = i
def get_index(self):
return self.index
def run(self, n):
self.intarray = new(Int16Array(n))
self.intarray[ self.index ] = 99
@returns( array=n )
@gpu.main
def gpufunc():
... | en | 0.211453 | external method ## GLSL compile error: `Index expression must be constant` #int idx = self.get_index() #return float( A[idx] ) | 2.56676 | 3 |
pages/views.py | Total-Conversion/eco4coin | 0 | 11707 | <gh_stars>0
from django.contrib.admin.views.decorators import staff_member_required
from django.views.generic import TemplateView, ListView
import csv
from django.http import HttpResponse
from backend.models import CustomUser
from django.contrib.auth.mixins import LoginRequiredMixin
class HomePageView(TemplateView):... | from django.contrib.admin.views.decorators import staff_member_required
from django.views.generic import TemplateView, ListView
import csv
from django.http import HttpResponse
from backend.models import CustomUser
from django.contrib.auth.mixins import LoginRequiredMixin
class HomePageView(TemplateView):
templat... | en | 0.474414 | # Create the HttpResponse object with the appropriate CSV header. | 2.19697 | 2 |
18.part2.py | elp2/advent_of_code_2018 | 1 | 11708 | from collections import defaultdict
def return_default():
return 0
REAL=open("18.txt").readlines()
SAMPLE=open("18.sample").readlines()
OPEN="."
TREE="|"
LUMBERYARD="#"
import copy
def safe_grid_get(grid, x, y, missing=None):
if x < 0 or y < 0:
return missing
if y >= len(grid):
return m... | from collections import defaultdict
def return_default():
return 0
REAL=open("18.txt").readlines()
SAMPLE=open("18.sample").readlines()
OPEN="."
TREE="|"
LUMBERYARD="#"
import copy
def safe_grid_get(grid, x, y, missing=None):
if x < 0 or y < 0:
return missing
if y >= len(grid):
return m... | oc | 0.109991 | # print(key) # print(solve(REAL, 10000)) 598 570 191420 599 571 189168 600 572 185082 601 573 185227 602 574 185320 603 575 185790 604 576 186120 605 577 189956 606 578 190068 607 579 191080 608 580 190405 # too low 609 581 193795 610 582 190950 611 583 193569 612 584 194350 613 585 196308 614 586 195364 615 587 197911... | 3.184079 | 3 |
PythonExercicios/ex031.py | Caio-Moretti/115.Exercicios-Python | 0 | 11709 | <gh_stars>0
dis = float(input('Digite a distância da sua viagem em Km: '))
if dis <= 200:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.5))
else:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.45))
| dis = float(input('Digite a distância da sua viagem em Km: '))
if dis <= 200:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.5))
else:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.45)) | none | 1 | 3.718046 | 4 | |
admin/collection_providers/forms.py | rdm-dev12/RDM-osf.io | 0 | 11710 | <filename>admin/collection_providers/forms.py
import bleach
import json
from django import forms
from osf.models import CollectionProvider, CollectionSubmission
from admin.base.utils import get_nodelicense_choices, get_defaultlicense_choices
class CollectionProviderForm(forms.ModelForm):
collected_type_choices ... | <filename>admin/collection_providers/forms.py
import bleach
import json
from django import forms
from osf.models import CollectionProvider, CollectionSubmission
from admin.base.utils import get_nodelicense_choices, get_defaultlicense_choices
class CollectionProviderForm(forms.ModelForm):
collected_type_choices ... | en | 0.732377 | # if this is to modify an existing CollectionProvider # if this is creating a CollectionProvider # if this is to modify an existing CollectionProvider # if this is creating a CollectionProvider | 1.904597 | 2 |
src/validate_model.py | mareklinka/esk-form-scanner-model | 0 | 11711 | <filename>src/validate_model.py
import data_providers as gen
import model_storage as storage
import numpy as np
import data_visualizer
import time
def evaluate(model_name):
"""
Evaluates the model stored in the specified file.
Parameters
----------
model_name : string
The name of the fil... | <filename>src/validate_model.py
import data_providers as gen
import model_storage as storage
import numpy as np
import data_visualizer
import time
def evaluate(model_name):
"""
Evaluates the model stored in the specified file.
Parameters
----------
model_name : string
The name of the fil... | en | 0.667729 | Evaluates the model stored in the specified file. Parameters ---------- model_name : string The name of the file to read the model from | 3.193499 | 3 |
sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v3_0_preview_1/models/_form_recognizer_client_enums.py | rsdoherty/azure-sdk-for-python | 0 | 11712 | <gh_stars>0
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# ... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | en | 0.71075 | # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ... | 2.198189 | 2 |
activity_log/migrations/0004_auto_20170309_0929.py | farezsaputra/BandwidthControllingSystem | 0 | 11713 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('activity_log', '0003_activitylog_extra_data'),
]
operations = [
migrations.AlterField(
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('activity_log', '0003_activitylog_extra_data'),
]
operations = [
migrations.AlterField(
... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.757758 | 2 |
bin/read_oogeso_data.py | oogeso/oogeso | 2 | 11714 | <filename>bin/read_oogeso_data.py<gh_stars>1-10
import json
import oogeso.io.file_io
# Read in data, validate date et.c. with methods from io
test_data_file = "examples/test case2.yaml"
json_data = oogeso.io.file_io.read_data_from_yaml(test_data_file)
json_formatted_str = json.dumps(json_data, indent=2)
print("Type ... | <filename>bin/read_oogeso_data.py<gh_stars>1-10
import json
import oogeso.io.file_io
# Read in data, validate date et.c. with methods from io
test_data_file = "examples/test case2.yaml"
json_data = oogeso.io.file_io.read_data_from_yaml(test_data_file)
json_formatted_str = json.dumps(json_data, indent=2)
print("Type ... | en | 0.175384 | # Read in data, validate date et.c. with methods from io # deserialize json data to objects # encoder = oogeso.dto.oogeso_input_data_objects.DataclassJSONEncoder # decoder = json.JSONDecoder() # energy_system = json.loads( # json_formatted_str, cls=encoder # ) # energy_system: oogeso.dto.oogeso_input_data_objects.En... | 2.952626 | 3 |
TWITOFF/__init__.py | DSPT3/Twitoff | 0 | 11715 | <filename>TWITOFF/__init__.py
""" Entry Point for Our Twitoff Flask App """
from .app import create_app
APP = create_app() | <filename>TWITOFF/__init__.py
""" Entry Point for Our Twitoff Flask App """
from .app import create_app
APP = create_app() | en | 0.713326 | Entry Point for Our Twitoff Flask App | 1.244904 | 1 |
fgivenx/test/test_mass.py | ejhigson/fgivenx | 11 | 11716 | import numpy
import pytest
import os
from shutil import rmtree
from numpy.testing import assert_allclose
import scipy.stats
import scipy.integrate
import scipy.special
from fgivenx.mass import PMF, compute_pmf
def gaussian_pmf(y, mu=0, sigma=1):
return scipy.special.erfc(numpy.abs(y-mu)/numpy.sqrt(2)/sigma)
def... | import numpy
import pytest
import os
from shutil import rmtree
from numpy.testing import assert_allclose
import scipy.stats
import scipy.integrate
import scipy.special
from fgivenx.mass import PMF, compute_pmf
def gaussian_pmf(y, mu=0, sigma=1):
return scipy.special.erfc(numpy.abs(y-mu)/numpy.sqrt(2)/sigma)
def... | en | 0.65745 | # Compute samples # Compute PMF # Compute PMF via monte carlo # Compute PMF via quadrature | 2.221509 | 2 |
homeassistant/components/vera/config_flow.py | liangleslie/core | 2 | 11717 | """Config flow for Vera."""
from __future__ import annotations
from collections.abc import Mapping
import logging
import re
from typing import Any
import pyvera as pv
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries i... | """Config flow for Vera."""
from __future__ import annotations
from collections.abc import Mapping
import logging
import re
from typing import Any
import pyvera as pv
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries i... | en | 0.71458 | Config flow for Vera. Fix the id list by converting it to a supported int list. Convert a string to an int list. Convert an int list to a string. Create a standard options object. Return options schema. Return options dict. Options for the component. Init object. Manage the options. Vera config flow. Get the options fl... | 2.156908 | 2 |
bin/setup_spectrum.py | MFSJMenger/pysurf | 7 | 11718 | <filename>bin/setup_spectrum.py<gh_stars>1-10
import os
from shutil import copy2 as copy
#
from pysurf.logger import get_logger
from pysurf.sampling import Sampling
from pysurf.setup import SetupBase
from pysurf.utils import exists_and_isfile
from pysurf.spp import SurfacePointProvider
from colt import Colt
from sp_ca... | <filename>bin/setup_spectrum.py<gh_stars>1-10
import os
from shutil import copy2 as copy
#
from pysurf.logger import get_logger
from pysurf.sampling import Sampling
from pysurf.setup import SetupBase
from pysurf.utils import exists_and_isfile
from pysurf.spp import SurfacePointProvider
from colt import Colt
from sp_ca... | en | 0.774435 | # # Number of conditions n_cond = :: int # Number of states nstates = :: int #Properties that should be calculated properties = ['energy', 'fosc'] :: list # Database containing all the initial conditions sampling_db = sampling.db :: existing_file # Filepath for the inputfile of th... | 2.440482 | 2 |
CeV - Gustavo Guanabara/exerc033.py | us19861229c/Meu-aprendizado-Python | 1 | 11719 | <gh_stars>1-10
#033: ler tres numeros e dizer qual o maior e qual o menor:
print("Digite 3 numeros:")
maiorn = 0
n = int(input("Numero 1: "))
if n > maiorn:
maiorn = n
menorn = n
n = int(input("Numero 2: "))
if n > maiorn:
maiorn = n
if n < menorn:
menorn = n
n = int(input("Numero 3: "))
if n > maiorn:... | #033: ler tres numeros e dizer qual o maior e qual o menor:
print("Digite 3 numeros:")
maiorn = 0
n = int(input("Numero 1: "))
if n > maiorn:
maiorn = n
menorn = n
n = int(input("Numero 2: "))
if n > maiorn:
maiorn = n
if n < menorn:
menorn = n
n = int(input("Numero 3: "))
if n > maiorn:
maiorn = n... | pt | 0.815665 | #033: ler tres numeros e dizer qual o maior e qual o menor: | 3.943869 | 4 |
test/test_dot.py | croqaz/dot | 0 | 11720 | <reponame>croqaz/dot
import pytest
from prop import strict_get
from prop import get as dot_get
class A:
def __init__(self, val):
self.val = val
def test_dot_get_list():
assert dot_get(['asd'], '0') == dot_get(['asd'], ['0']) == 'asd'
data = {'nested': [0, False, 'foo']}
assert dot_get(data... | import pytest
from prop import strict_get
from prop import get as dot_get
class A:
def __init__(self, val):
self.val = val
def test_dot_get_list():
assert dot_get(['asd'], '0') == dot_get(['asd'], ['0']) == 'asd'
data = {'nested': [0, False, 'foo']}
assert dot_get(data, 'nested.0') == 0
... | en | 0.521295 | # inexistent # inexistent # String paths can only access string keys, so this won't work: # assert dot_get(data, 'nested.1') == '1' # assert dot_get(data, 'nested.None') == 'null' # But this works: # Create cyclic ref | 2.578412 | 3 |
site_scons/site_tools/mplabx_nbproject/__init__.py | kbhomes/ps2plus | 0 | 11721 | from pprint import pprint
import SCons.Builder
from SCons.Script import *
import json
import os
import copy
import collections
import xml.etree.ElementTree as ET
from mplabx import MPLABXProperties
MAKEFILE_TEXT = '''
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
build: .build-post
.build-pre:
.build-post: .build-i... | from pprint import pprint
import SCons.Builder
from SCons.Script import *
import json
import os
import copy
import collections
import xml.etree.ElementTree as ET
from mplabx import MPLABXProperties
MAKEFILE_TEXT = '''
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
build: .build-post
.build-pre:
.build-post: .build-i... | en | 0.453818 | MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib build: .build-post .build-pre: .build-post: .build-impl clean: .clean-post .clean-pre: .clean-post: .clean-impl clobber: .clobber-post .clobber-pre: .clobber-post: .clobber-impl all: .all-post .all-pre: .all-post: .all-impl help: .help-post .help-pre: .help-post: .he... | 2.282448 | 2 |
lib/autoconnect/example/test_server.py | simotek/autoconnect | 0 | 11722 | <gh_stars>0
#
# test_server.py
#
# Copyright (C) 2001-2007 <NAME>.
# Email: <EMAIL>
#
# This library 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 Foundation; either
# version 2.1 of the Li... | #
# test_server.py
#
# Copyright (C) 2001-2007 <NAME>.
# Email: <EMAIL>
#
# This library 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 Foundation; either
# version 2.1 of the License, or (a... | en | 0.819491 | # # test_server.py # # Copyright (C) 2001-2007 <NAME>. # Email: <EMAIL> # # This library 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 Foundation; either # version 2.1 of the License, or (at your op... | 2.746687 | 3 |
tests/test_loop_seer.py | Kyle-Kyle/angr | 6,132 | 11723 | <gh_stars>1000+
import os
import sys
import angr
import nose.tools
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_various_loops():
p = angr.Project(os.path.join(test_location, 'x86_64', 'various_loops'), auto_load_libs=False)
cfg = p.anal... | import os
import sys
import angr
import nose.tools
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_various_loops():
p = angr.Project(os.path.join(test_location, 'x86_64', 'various_loops'), auto_load_libs=False)
cfg = p.analyses.CFGFast(nor... | none | 1 | 1.973137 | 2 | |
shongololo/Imet_serial.py | swyngaard/shongololo | 0 | 11724 | import serial , time , os
import serial.tools.list_ports as port
import logging
sho_logger = logging.getLogger("shongololo_logger")
def open_imets(devices):
"""Tries to open as many imet device serial ports as there are
:return:
a list of socket handles
"""
imet_sockets = []
for d in range(... | import serial , time , os
import serial.tools.list_ports as port
import logging
sho_logger = logging.getLogger("shongololo_logger")
def open_imets(devices):
"""Tries to open as many imet device serial ports as there are
:return:
a list of socket handles
"""
imet_sockets = []
for d in range(... | en | 0.922331 | Tries to open as many imet device serial ports as there are :return: a list of socket handles # Create list of imet open ports Finds available imet serial ports and determines which device is attached to which /dev/ path :rtype: object :return: A dictionary of devices labled as" imet<number startin... | 2.877583 | 3 |
libs/external_libs/docutils-0.4/test/test_transforms/test_peps.py | google-code-export/django-hotclub | 3 | 11725 | #! /usr/bin/env python
# Author: <NAME>
# Contact: <EMAIL>
# Revision: $Revision: 3915 $
# Date: $Date: 2005-10-02 03:06:42 +0200 (Sun, 02 Oct 2005) $
# Copyright: This module has been placed in the public domain.
"""
Tests for docutils.transforms.peps.
"""
from __init__ import DocutilsTestSupport
from docutils.tran... | #! /usr/bin/env python
# Author: <NAME>
# Contact: <EMAIL>
# Revision: $Revision: 3915 $
# Date: $Date: 2005-10-02 03:06:42 +0200 (Sun, 02 Oct 2005) $
# Copyright: This module has been placed in the public domain.
"""
Tests for docutils.transforms.peps.
"""
from __init__ import DocutilsTestSupport
from docutils.tran... | en | 0.51065 | #! /usr/bin/env python # Author: <NAME> # Contact: <EMAIL> # Revision: $Revision: 3915 $ # Date: $Date: 2005-10-02 03:06:42 +0200 (Sun, 02 Oct 2005) $ # Copyright: This module has been placed in the public domain. Tests for docutils.transforms.peps. \ No references or targets exist, therefore no "References" section sh... | 2.478319 | 2 |
rental_property/migrations/0011_alter_rentalunit_options.py | shumwe/rental-house-management-system | 1 | 11726 | # Generated by Django 4.0.2 on 2022-03-15 22:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rental_property', '0010_alter_rentalunit_status'),
]
operations = [
migrations.AlterModelOptions(
name='rentalunit',
options... | # Generated by Django 4.0.2 on 2022-03-15 22:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rental_property', '0010_alter_rentalunit_status'),
]
operations = [
migrations.AlterModelOptions(
name='rentalunit',
options... | en | 0.86421 | # Generated by Django 4.0.2 on 2022-03-15 22:43 | 1.484187 | 1 |
AxesFrame.py | Toyuri453/RSSP-Python-demo | 1 | 11727 | <filename>AxesFrame.py
import Terminal
class Axes():
def __init__(self, weak_terminal : 'Terminal.CartesianPoint'):
# self._initiator_x = weak_terminal._x
# self._initiator_y = weak_terminal._y
self._initiator = Terminal.CartesianPoint(0.0, 0.0, "UWB", "initiator")
self._weak... | <filename>AxesFrame.py
import Terminal
class Axes():
def __init__(self, weak_terminal : 'Terminal.CartesianPoint'):
# self._initiator_x = weak_terminal._x
# self._initiator_y = weak_terminal._y
self._initiator = Terminal.CartesianPoint(0.0, 0.0, "UWB", "initiator")
self._weak... | en | 0.443094 | # self._initiator_x = weak_terminal._x # self._initiator_y = weak_terminal._y #Fill Later | 2.700382 | 3 |
api/generate.py | almeida-matheus/playlist-reader | 0 | 11728 | <reponame>almeida-matheus/playlist-reader
import re
from bs4 import BeautifulSoup # beautifulsoup4
import requests # requests
HEADER = {
"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
}
def catch_info(base,pattern,str_add='... | import re
from bs4 import BeautifulSoup # beautifulsoup4
import requests # requests
HEADER = {
"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
}
def catch_info(base,pattern,str_add=''):
'''base text, pattern to search, s... | en | 0.471633 | # beautifulsoup4 # requests base text, pattern to search, string to increment if necessary # set(array_video) # response = generate('PLMKi-ss_sEoOZw9TB4iCrevTK60uY8wg0') # print(response) | 2.959323 | 3 |
homeassistant/components/deconz/const.py | hoverduck/core | 1 | 11729 | <filename>homeassistant/components/deconz/const.py
"""Constants for the deCONZ component."""
import logging
LOGGER = logging.getLogger(__package__)
DOMAIN = "deconz"
CONF_BRIDGE_ID = "bridgeid"
CONF_GROUP_ID_BASE = "group_id_base"
DEFAULT_PORT = 80
DEFAULT_ALLOW_CLIP_SENSOR = False
DEFAULT_ALLOW_DECONZ_GROUPS = Tru... | <filename>homeassistant/components/deconz/const.py
"""Constants for the deCONZ component."""
import logging
LOGGER = logging.getLogger(__package__)
DOMAIN = "deconz"
CONF_BRIDGE_ID = "bridgeid"
CONF_GROUP_ID_BASE = "group_id_base"
DEFAULT_PORT = 80
DEFAULT_ALLOW_CLIP_SENSOR = False
DEFAULT_ALLOW_DECONZ_GROUPS = Tru... | en | 0.659598 | Constants for the deCONZ component. | 1.679698 | 2 |
course_app/api/views.py | maks-nurgazy/diploma-project | 0 | 11730 | <reponame>maks-nurgazy/diploma-project
import json
from rest_framework.generics import ListAPIView, get_object_or_404
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
from course_app.api.serializers import CourseSerializer
from cour... | import json
from rest_framework.generics import ListAPIView, get_object_or_404
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
from course_app.api.serializers import CourseSerializer
from course_app.models import Course, Enrolled
f... | none | 1 | 2.277981 | 2 | |
service/repository/repository_controller.py | yutiansut/cilantro | 3 | 11731 | <gh_stars>1-10
import os
import json
import logging
import yaml
from flask import Blueprint, jsonify, send_file, request, redirect
from service.errors import ApiError
from utils.repository import generate_repository_path, \
list_objects_in_repository
from utils.list_dir import list_dir
repository_controller = Bl... | import os
import json
import logging
import yaml
from flask import Blueprint, jsonify, send_file, request, redirect
from service.errors import ApiError
from utils.repository import generate_repository_path, \
list_objects_in_repository
from utils.list_dir import list_dir
repository_controller = Blueprint('reposi... | en | 0.71006 | List the ids of all cilantro objects in the repository. Returns a list of the object_ids .. :quickref: Repository Controller; List IDs of objects in the repository **Example request**: .. sourcecode:: http GET /repository/ HTTP/1.1 **Example response**: .. sourcecode:: http ... | 2.64177 | 3 |
src/python_import/C/cc.py | matiastang/matias-python | 0 | 11732 | #!/usr/bin/python3
#coding=utf-8
def cc_debug():
print(__name__) | #!/usr/bin/python3
#coding=utf-8
def cc_debug():
print(__name__) | en | 0.258639 | #!/usr/bin/python3 #coding=utf-8 | 1.226392 | 1 |
plugin.audio.podcasts/addon.py | stobb3s/kodi-addon-podcast | 0 | 11733 | from datetime import datetime
import base64
import os
import re
import requests
import sys
import urllib.parse
import xmltodict
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import xbmcvfs
__PLUGIN_ID__ = "plugin.audio.podcasts"
# see https://forum.kodi.tv/showthread.php?tid=112916
_MONTHS = ["Jan", ... | from datetime import datetime
import base64
import os
import re
import requests
import sys
import urllib.parse
import xmltodict
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import xbmcvfs
__PLUGIN_ID__ = "plugin.audio.podcasts"
# see https://forum.kodi.tv/showthread.php?tid=112916
_MONTHS = ["Jan", ... | en | 0.709257 | # see https://forum.kodi.tv/showthread.php?tid=112916 # available since Kodi v20 # not supported yet #if duration is already in seconds #try converting HH:MM:SS or MM:SS string to integer seconds #HH:MM:SS #MM:SS # available since Kodi v20 # opml files / podcasts lists # rss feeds from settings # root # Step 1: Select... | 2.323283 | 2 |
.venv/Lib/site-packages/lemoncheesecake/reporting/savingstrategy.py | yadavdeepa365/HUDL_PYTHON | 34 | 11734 | import re
import time
from lemoncheesecake.events import TestSessionSetupEndEvent, TestSessionTeardownEndEvent, \
TestEndEvent, SuiteSetupEndEvent, SuiteTeardownEndEvent, SuiteEndEvent, SteppedEvent
from lemoncheesecake.reporting.report import ReportLocation
DEFAULT_REPORT_SAVING_STRATEGY = "at_each_failed_test"
... | import re
import time
from lemoncheesecake.events import TestSessionSetupEndEvent, TestSessionTeardownEndEvent, \
TestEndEvent, SuiteSetupEndEvent, SuiteTeardownEndEvent, SuiteEndEvent, SteppedEvent
from lemoncheesecake.reporting.report import ReportLocation
DEFAULT_REPORT_SAVING_STRATEGY = "at_each_failed_test"
... | en | 0.874807 | # not a saving but an initialization # first, try with a static expression # no need to an intermediate report saving in this case # deprecated since 1.4.5, "at_each_log" must be used instead # second, try with "every_Ns" # ok... nothing we know about | 2.226552 | 2 |
genshin/models/genshin/chronicle/notes.py | thesadru/genshin.py | 63 | 11735 | """Genshin chronicle notes."""
import datetime
import typing
import pydantic
from genshin.models.genshin import character
from genshin.models.model import Aliased, APIModel
__all__ = ["Expedition", "ExpeditionCharacter", "Notes"]
def _process_timedelta(time: typing.Union[int, datetime.timedelta, datetime.datetime]... | """Genshin chronicle notes."""
import datetime
import typing
import pydantic
from genshin.models.genshin import character
from genshin.models.model import Aliased, APIModel
__all__ = ["Expedition", "ExpeditionCharacter", "Notes"]
def _process_timedelta(time: typing.Union[int, datetime.timedelta, datetime.datetime]... | en | 0.898688 | Genshin chronicle notes. Expedition character. Real-Time note expedition. Whether the expedition has finished. # type: ignore Transformer recovery time. Real-Time notes. The remaining time until resin recovery in seconds. The remaining time until realm currency recovery in seconds. The remaining time until realm curren... | 2.456309 | 2 |
src/the_tale/the_tale/common/bbcode/renderer.py | al-arz/the-tale | 85 | 11736 | <reponame>al-arz/the-tale
import smart_imports
smart_imports.all()
class Renderer:
__slots__ = ('tags', '_renderer')
def __init__(self, tags):
self.tags = tags
self._renderer = postmarkup.create(include=[],
use_pygments=False,
... | import smart_imports
smart_imports.all()
class Renderer:
__slots__ = ('tags', '_renderer')
def __init__(self, tags):
self.tags = tags
self._renderer = postmarkup.create(include=[],
use_pygments=False,
anno... | none | 1 | 2.243883 | 2 | |
tests/python/unittest/test_meta_schedule_custom_rule_winograd_cpu.py | psrivas2/relax | 11 | 11737 | # 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 (the
# "License"); you may not u... | # 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 (the
# "License"); you may not u... | en | 0.809586 | # 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 (the # "License"); you may not u... | 1.883232 | 2 |
model_zoo/official/cv/FCN8s/src/nets/FCN8s.py | LottieWang/mindspore | 0 | 11738 | <filename>model_zoo/official/cv/FCN8s/src/nets/FCN8s.py<gh_stars>0
# Copyright 2021 Huawei Technologies Co., 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.or... | <filename>model_zoo/official/cv/FCN8s/src/nets/FCN8s.py<gh_stars>0
# Copyright 2021 Huawei Technologies Co., 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.or... | en | 0.807619 | # Copyright 2021 Huawei Technologies Co., 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 required by applicable law or agreed to... | 2.17079 | 2 |
scripts/seqrun_processing/sync_seqrun_data_from_remote.py | imperial-genomics-facility/data-management-python | 7 | 11739 | #!/usr/bin/env python
import argparse
from igf_data.task_tracking.igf_slack import IGF_slack
from igf_data.process.data_transfer.sync_seqrun_data_on_remote import Sync_seqrun_data_from_remote
parser = argparse.ArgumentParser()
parser.add_argument('-r','--remote_server', required=True, help='Remote server address')
par... | #!/usr/bin/env python
import argparse
from igf_data.task_tracking.igf_slack import IGF_slack
from igf_data.process.data_transfer.sync_seqrun_data_on_remote import Sync_seqrun_data_from_remote
parser = argparse.ArgumentParser()
parser.add_argument('-r','--remote_server', required=True, help='Remote server address')
par... | ru | 0.147624 | #!/usr/bin/env python ## FIX ME | 2.104074 | 2 |
pydashlite/arrays/sum_by.py | glowlex/pydashlite | 0 | 11740 | from typing import Callable, Iterable, TypeVar
T = TypeVar('T')
Num = TypeVar('Num', int, float)
def sumBy(array: Iterable[T], iteratee: Callable[[T], Num] = None, start: Num = 0) -> Num:
if iteratee is None:
return sum([y for y in array], start)
return sum([iteratee(y) for y in array], start)
| from typing import Callable, Iterable, TypeVar
T = TypeVar('T')
Num = TypeVar('Num', int, float)
def sumBy(array: Iterable[T], iteratee: Callable[[T], Num] = None, start: Num = 0) -> Num:
if iteratee is None:
return sum([y for y in array], start)
return sum([iteratee(y) for y in array], start)
| none | 1 | 3.398419 | 3 | |
Ten_Most_Common_Words.py | mcjohnchristopher/Python_Samples | 0 | 11741 | <reponame>mcjohnchristopher/Python_Samples
fhand = (romeo.txt)
counts = dict()
for line in fhand:
words = line.split()
for word in words():
count word = count.get(word, 0) + 1
st = list
for Key,Value in count.items():
st.append((val,key))
st.sort(reverse = true)
for val,key in st[:10]:
print key, v... | fhand = (romeo.txt)
counts = dict()
for line in fhand:
words = line.split()
for word in words():
count word = count.get(word, 0) + 1
st = list
for Key,Value in count.items():
st.append((val,key))
st.sort(reverse = true)
for val,key in st[:10]:
print key, val
#Using Sorted Function
sorted [(v,k... | en | 0.555972 | #Using Sorted Function | 3.176528 | 3 |
python/testData/intentions/convertLambdaToFunction.py | jnthn/intellij-community | 2 | 11742 | newlist = lambda x<caret>, y: (x+y)/y
x = 1 | newlist = lambda x<caret>, y: (x+y)/y
x = 1 | none | 1 | 1.554565 | 2 | |
src/grpc_client.py | thealphadollar/py-grpcio-pg | 0 | 11743 | import grpc
from consts import PORT, SERVER_CERT
from grpc_generated_files import api_pb2, api_pb2_grpc
def main(stub):
request = api_pb2.ApiRequest(
name="Shivam",
message="Hey there!"
)
response = stub.ApiEndpoint(request)
print(response)
if __name__ == "__main__":
with open(S... | import grpc
from consts import PORT, SERVER_CERT
from grpc_generated_files import api_pb2, api_pb2_grpc
def main(stub):
request = api_pb2.ApiRequest(
name="Shivam",
message="Hey there!"
)
response = stub.ApiEndpoint(request)
print(response)
if __name__ == "__main__":
with open(S... | en | 0.899833 | # the server IP should be in the common name of the certificate | 2.768 | 3 |
0188.Best Time to Buy and Sell Stock IV/solution.py | zhlinh/leetcode | 0 | 11744 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: <EMAIL>
Version: 0.0.1
Created Time: 2016-03-23
Last_modify: 2016-03-23
******************************************
'''
'''
Say you have an array for which the ith element is
th... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: <EMAIL>
Version: 0.0.1
Created Time: 2016-03-23
Last_modify: 2016-03-23
******************************************
'''
'''
Say you have an array for which the ith element is
th... | en | 0.709449 | #!/usr/bin/env python # -*- coding: utf-8 -*- ***************************************** Author: zhlinh Email: <EMAIL> Version: 0.0.1 Created Time: 2016-03-23 Last_modify: 2016-03-23 ****************************************** Say you have an array for which the ith element is the price of a ... | 3.907835 | 4 |
gips/gistmodel/post_processing.py | accsc/gips | 1 | 11745 | <filename>gips/gistmodel/post_processing.py
import numpy as np
import copy
from gips import FLOAT
from gips import DOUBLE
class post_processing(object):
def __init__(self, fitter, x, pairs=False, prefix=None):
self.fitter = fitter
self.x = x
self.pairs = pairs
self.case =... | <filename>gips/gistmodel/post_processing.py
import numpy as np
import copy
from gips import FLOAT
from gips import DOUBLE
class post_processing(object):
def __init__(self, fitter, x, pairs=False, prefix=None):
self.fitter = fitter
self.x = x
self.pairs = pairs
self.case =... | en | 0.182338 | ### Apply the solution to the scoring function ### |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ### |OVERVIEW OF THE DATA STRUCTURE IN THE FITTER OBJECT| ### |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ### ### Experimental data stored with gdat_fit_lib ### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #... | 2.613756 | 3 |
src/Cogs/InfoCog.py | kodyVS/Discord-Bot-Development | 5 | 11746 | <filename>src/Cogs/InfoCog.py
from discord.ext import commands
import discord
import requests
from bs4 import BeautifulSoup
# work in progress! more languages welcome!
class InfoCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name = 'docs', brief = 'programming language d... | <filename>src/Cogs/InfoCog.py
from discord.ext import commands
import discord
import requests
from bs4 import BeautifulSoup
# work in progress! more languages welcome!
class InfoCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name = 'docs', brief = 'programming language d... | en | 0.850606 | # work in progress! more languages welcome! # access docs based on language ### TODO: multi-lingual docs support (devdocs.io?) ### TODO: faster searching (current 4-5 secs) ### TODO: filter results -> currently only pick top ten, and there are some odd results as well Gets the GitHub first < amount > repositories witho... | 2.765928 | 3 |
Python/List/37.drop.py | angelmpalomares/ModelAndLanguagesForBioInformatics | 0 | 11747 | def drop(i_list: list,n:int) -> list:
"""
Drop at multiple of n from the list
:param n: Drop from the list i_list every N element
:param i_list: The source list
:return: The returned list
"""
assert(n>0)
_shallow_list = []
k=1
for element in i_list:
if k % n != 0:
... | def drop(i_list: list,n:int) -> list:
"""
Drop at multiple of n from the list
:param n: Drop from the list i_list every N element
:param i_list: The source list
:return: The returned list
"""
assert(n>0)
_shallow_list = []
k=1
for element in i_list:
if k % n != 0:
... | en | 0.652137 | Drop at multiple of n from the list :param n: Drop from the list i_list every N element :param i_list: The source list :return: The returned list | 3.92806 | 4 |
cil/balanced_experience_replay.py | itaicaspi-intel/advanced-coach | 1 | 11748 | <gh_stars>1-10
#
# Copyright (c) 2017 Intel Corporation
#
# 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 l... | #
# Copyright (c) 2017 Intel Corporation
#
# 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... | en | 0.85432 | # # Copyright (c) 2017 Intel Corporation # # 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... | 2.120197 | 2 |
tools/schedprof/schedprof/mutex.py | ivochkin/dfk | 1 | 11749 | <reponame>ivochkin/dfk
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from schedprof.enumerated_instance import EnumeratedInstance
class Mutex(EnumeratedInstance):
def __init__(self):
super(Mutex, self).__init__(Mutex)
self.acquired_by = None
self.wait_queue = []
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from schedprof.enumerated_instance import EnumeratedInstance
class Mutex(EnumeratedInstance):
def __init__(self):
super(Mutex, self).__init__(Mutex)
self.acquired_by = None
self.wait_queue = [] | en | 0.352855 | #!/usr/bin/env python # -*- coding: utf-8 -*- | 2.447153 | 2 |
openpype/hosts/houdini/plugins/publish/increment_current_file.py | jonclothcat/OpenPype | 87 | 11750 | import pyblish.api
import avalon.api
from openpype.api import version_up
from openpype.action import get_errored_plugins_from_data
class IncrementCurrentFile(pyblish.api.InstancePlugin):
"""Increment the current file.
Saves the current scene with an increased version number.
"""
label = "Increment... | import pyblish.api
import avalon.api
from openpype.api import version_up
from openpype.action import get_errored_plugins_from_data
class IncrementCurrentFile(pyblish.api.InstancePlugin):
"""Increment the current file.
Saves the current scene with an increased version number.
"""
label = "Increment... | en | 0.938129 | Increment the current file. Saves the current scene with an increased version number. # This should be a ContextPlugin, but this is a workaround # for a bug in pyblish to run once for a family: issue #250 # Filename must not have changed since collecting | 2.210091 | 2 |
968 Binary Tree Cameras.py | krishna13052001/LeetCode | 872 | 11751 | #!/usr/bin/python3
"""
Given a binary tree, we install cameras on the nodes of the tree.
Each camera at a node can monitor its parent, itself, and its immediate children.
Calculate the minimum number of cameras needed to monitor all nodes of the tree.
Example 1:
Input: [0,0,null,0,0]
Output: 1
Explanation: One c... | #!/usr/bin/python3
"""
Given a binary tree, we install cameras on the nodes of the tree.
Each camera at a node can monitor its parent, itself, and its immediate children.
Calculate the minimum number of cameras needed to monitor all nodes of the tree.
Example 1:
Input: [0,0,null,0,0]
Output: 1
Explanation: One c... | en | 0.897082 | #!/usr/bin/python3 Given a binary tree, we install cameras on the nodes of the tree. Each camera at a node can monitor its parent, itself, and its immediate children. Calculate the minimum number of cameras needed to monitor all nodes of the tree. Example 1: Input: [0,0,null,0,0] Output: 1 Explanation: One camer... | 4.103509 | 4 |
examples/get_tiktoks_by_sound.py | twitter-79/TikTok-Api | 2,095 | 11752 | <gh_stars>1000+
from TikTokApi import TikTokApi
api = TikTokApi.get_instance()
count = 30
# You can find this from a tiktok getting method in another way or find songs from the discoverMusic method.
sound_id = "6601861313180207878"
tiktoks = api.by_sound(sound_id, count=count)
for tiktok in tiktoks:
print(tikt... | from TikTokApi import TikTokApi
api = TikTokApi.get_instance()
count = 30
# You can find this from a tiktok getting method in another way or find songs from the discoverMusic method.
sound_id = "6601861313180207878"
tiktoks = api.by_sound(sound_id, count=count)
for tiktok in tiktoks:
print(tiktok) | en | 0.869276 | # You can find this from a tiktok getting method in another way or find songs from the discoverMusic method. | 2.590525 | 3 |
code/SimPleAC_pof_paperplots.py | 1ozturkbe/robustSPpaper | 0 | 11753 | from builtins import str
from builtins import range
from robust.simulations.simulate import filter_gamma_result_dict
from SimPleAC_save import load_obj
import pickle as pickle
import numpy as np
import matplotlib.pyplot as plt
from SimPleAC_pof_simulate import pof_parameters
if __name__ == "__main__":
# Retrieving... | from builtins import str
from builtins import range
from robust.simulations.simulate import filter_gamma_result_dict
from SimPleAC_save import load_obj
import pickle as pickle
import numpy as np
import matplotlib.pyplot as plt
from SimPleAC_pof_simulate import pof_parameters
if __name__ == "__main__":
# Retrieving... | en | 0.364572 | # Retrieving pof parameters # only care about Best Pairs # Loading results # Plotting of cost and probability of failure # ax1.legend(loc="lower right", fontsize=10, numpoints=1) # fig.legend(loc="lower right", fontsize=10, numpoints=1) | 2.212782 | 2 |
test/show-cifar10.py | tom01h/deep-learning-from-scratch | 3 | 11754 | <filename>test/show-cifar10.py<gh_stars>1-10
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from dataset.cifar10 import load_cifar10
from PIL import Image
np.set_printoptions(threshold=100)
(x_train, t_train), (x_test, t_test) = load_cifar10(flatten=... | <filename>test/show-cifar10.py<gh_stars>1-10
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from dataset.cifar10 import load_cifar10
from PIL import Image
np.set_printoptions(threshold=100)
(x_train, t_train), (x_test, t_test) = load_cifar10(flatten=... | ja | 0.969786 | # coding: utf-8 # 親ディレクトリのファイルをインポートするための設定 # 先頭100個をタイル状に並べ替える #pil_img = Image.fromarray(np.uint8(sample_image*255)) #pil_img.show() | 2.849947 | 3 |
vertex-server/signals/__init__.py | aoswalt/greenlite-hardware | 0 | 11755 | from . import lights
from . import schedule
| from . import lights
from . import schedule
| none | 1 | 0.936942 | 1 | |
PWWS/fool.py | ForeverZyh/ASCC | 21 | 11756 | <reponame>ForeverZyh/ASCC
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import argparse
import os
import numpy as np
from read_files import split_imdb_files, split_yahoo_files, split_agnews_files
from word_level_process import wo... | # coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import argparse
import os
import numpy as np
from read_files import split_imdb_files, split_yahoo_files, split_agnews_files
from word_level_process import word_process, get_tokenizer
... | en | 0.80503 | # coding: utf-8 # os.environ["CUDA_VISIBLE_DEVICES"] = "1" # 1000 # get tokenizer # Read data set # Write clean examples into a txt file # Select the model and load the trained weights # evaluate classification accuracy of model on clean samples # If the ground_true label is the same as the predicted label # get tokeni... | 2.12096 | 2 |
test_training_data.py | miermans/gym-2048 | 0 | 11757 | #!/usr/bin/env python
from __future__ import absolute_import
import numpy as np
import os
import pytest
import tempfile
import training_data
class TestTrainingData():
def test_add(self):
td = training_data.training_data()
assert np.array_equal(td.get_x(), np.empty([0, 4, 4], dtype=np.int))
... | #!/usr/bin/env python
from __future__ import absolute_import
import numpy as np
import os
import pytest
import tempfile
import training_data
class TestTrainingData():
def test_add(self):
td = training_data.training_data()
assert np.array_equal(td.get_x(), np.empty([0, 4, 4], dtype=np.int))
... | en | 0.756723 | #!/usr/bin/env python # Original # Hflip'd # Original, rotated 90 degrees # Hflip, rotated 90 degrees # Original, rotated 180 degrees # Hflip, rotated 180 degrees # Original, rotate 270 degrees # Hflip, rotated 270 degrees # Set up training data # Set up training data # Test using default gamma value of 0.9 # Test usin... | 2.543857 | 3 |
tests/test_db_exam_psd.py | awenhaowenchao/bee | 4 | 11758 | <reponame>awenhaowenchao/bee
from datetime import datetime
from bee import Psd, CX, On, T
from bee import Model, IntegerField, StringField, DateTimeField, Equal, W, C
db_exam = Psd.open("exam")
# 1) sing table count search, SELECT COUNT(*) AS COUNT FROM t_teacher
with db_exam.connection() as conn:
teacher_count =... | from datetime import datetime
from bee import Psd, CX, On, T
from bee import Model, IntegerField, StringField, DateTimeField, Equal, W, C
db_exam = Psd.open("exam")
# 1) sing table count search, SELECT COUNT(*) AS COUNT FROM t_teacher
with db_exam.connection() as conn:
teacher_count = db_exam.Select(*CX("COUNT(*)... | en | 0.328975 | # 1) sing table count search, SELECT COUNT(*) AS COUNT FROM t_teacher # 2) sing table search, SELECT * FROM t_teacher # 3) sing table search, SELECT * FROM t_teacher convert values to model of Teacher # 4) sing table search, SELECT * FROM t_teacher WHERE id=? convert values to model of Teacher # 5) tow table Join searc... | 2.73338 | 3 |
slybot/slybot/plugins/scrapely_annotations/builder.py | coolkunal64/ht | 0 | 11759 | <gh_stars>0
import json
from scrapy import Selector
from scrapy.utils.spider import arg_to_iter
from scrapely.htmlpage import parse_html, HtmlTag, HtmlDataFragment
from collections import defaultdict
from itertools import tee, count, groupby
from operator import itemgetter
from slybot.utils import (serialize_tag, ad... | import json
from scrapy import Selector
from scrapy.utils.spider import arg_to_iter
from scrapely.htmlpage import parse_html, HtmlTag, HtmlDataFragment
from collections import defaultdict
from itertools import tee, count, groupby
from operator import itemgetter
from slybot.utils import (serialize_tag, add_tagids, re... | en | 0.809731 | data = { extracts: [ { annotations: {"content": "Title"}, id: "id-string", required: [], tagid: 12, # All keys below are optional variant: 0, text-conte... | 2.214416 | 2 |
scripts/slave/recipes/mojo.py | bopopescu/chromium-build | 0 | 11760 | <filename>scripts/slave/recipes/mojo.py
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'adb',
'depot_tools/bot_update',
'depot_tools/gclient',
'goma',
'recipe_engine/context',
'recipe... | <filename>scripts/slave/recipes/mojo.py
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'adb',
'depot_tools/bot_update',
'depot_tools/gclient',
'goma',
'recipe_engine/context',
'recipe... | en | 0.874458 | # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Checkout mojo and its dependencies (specified in DEPS) using gclient # Disable Goma on Windows as it makes the build much slower (> 1 hour vs # 15 minutes).... | 1.467114 | 1 |
lib/navigation/AreaFighting.py | sadnecc/pb | 0 | 11761 | <gh_stars>0
# -*- coding:utf8 -*-
import random
import time
from lib.navigation.PathFinding import Pathfinding
from lib.control.Control import Control
from lib.unit.Player import Player
from lib.struct.CoordiPoint import CoordiPoint
# 区域打怪
class AreaFighting(Pathfinding):
# area_pos: 区域4角坐标。顺序为:左上,右上,左下,右下
def... | # -*- coding:utf8 -*-
import random
import time
from lib.navigation.PathFinding import Pathfinding
from lib.control.Control import Control
from lib.unit.Player import Player
from lib.struct.CoordiPoint import CoordiPoint
# 区域打怪
class AreaFighting(Pathfinding):
# area_pos: 区域4角坐标。顺序为:左上,右上,左下,右下
def __init__(se... | zh | 0.313832 | # -*- coding:utf8 -*- # 区域打怪 # area_pos: 区域4角坐标。顺序为:左上,右上,左下,右下 # 回到区域内 #################################################################################") #################################################################################", file=self.hander_area) #在区域外选中怪先取消掉,免得走回区域后又跑出来打这个怪 # 直接走向区域中心,没有多余路点 #self.play... | 2.679406 | 3 |
compress.py | willemwouters/PhotoboothPi | 0 | 11762 | <filename>compress.py<gh_stars>0
import os
import time
import sys
if(len(sys.argv) is 1):
path="/home/pi/storage/"
else:
path=sys.argv[1]
try:
arr=[]
for filename in os.listdir(path):
if("2018-09" in filename):
arr.append(filename)
for f in arr:
filen = os.path.spl... | <filename>compress.py<gh_stars>0
import os
import time
import sys
if(len(sys.argv) is 1):
path="/home/pi/storage/"
else:
path=sys.argv[1]
try:
arr=[]
for filename in os.listdir(path):
if("2018-09" in filename):
arr.append(filename)
for f in arr:
filen = os.path.spl... | none | 1 | 2.587705 | 3 | |
html/en/reference/graphs/sage/graphs/graph_plot-2.py | sagemath/documentation | 10 | 11763 | <reponame>sagemath/documentation
petersen_spring = Graph(':I`ES@obGkqegW~')
sphinx_plot(petersen_spring) | petersen_spring = Graph(':I`ES@obGkqegW~')
sphinx_plot(petersen_spring) | none | 1 | 1.217774 | 1 | |
module00/ex05/kata00.py | MedAymenF/42AI-Python-bootcamp | 0 | 11764 | <filename>module00/ex05/kata00.py<gh_stars>0
t = (19, 42, 21)
print(f"The {len(t)} numbers are: {t[0]}, {t[1]}, {t[2]}")
| <filename>module00/ex05/kata00.py<gh_stars>0
t = (19, 42, 21)
print(f"The {len(t)} numbers are: {t[0]}, {t[1]}, {t[2]}")
| none | 1 | 2.313081 | 2 | |
examples/cochrane-simplification/log_regression/bow_newsela_lm_tokens.py | AshOlogn/transformers | 0 | 11765 | import json
import os
from os.path import join
from random import shuffle
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.preprocessing import MinMaxScaler, normalize
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cros... | import json
import os
from os.path import join
from random import shuffle
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.preprocessing import MinMaxScaler, normalize
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cros... | en | 0.621389 | #X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) #apply feature scaling #X_train = normalize(X_train) #X_test = normalize(X_test) #model.fit(X_train, y_train) #predictions = model.predict(X_test) #print(accuracy_score(y_test, predictions)) | 2.319638 | 2 |
fdrtd_server/exceptions.py | UNakade/server | 0 | 11766 | <filename>fdrtd_server/exceptions.py
import logging as _logging
def handle_exception(e):
if isinstance(e, ApiError):
_logging.exception(e.message)
return e.message, e.statuscode
_logging.exception(repr(e))
return None, 500
class ApiError(Exception):
def __init__(self, statuscode, ... | <filename>fdrtd_server/exceptions.py
import logging as _logging
def handle_exception(e):
if isinstance(e, ApiError):
_logging.exception(e.message)
return e.message, e.statuscode
_logging.exception(repr(e))
return None, 500
class ApiError(Exception):
def __init__(self, statuscode, ... | none | 1 | 2.418909 | 2 | |
TCU/usageexample/automationexample.py | p--q/TCU | 0 | 11767 | <reponame>p--q/TCU
#!/opt/libreoffice5.4/program/python
# -*- coding: utf-8 -*-
import unohelper # オートメーションには必須(必須なのはuno)。
def macro():
ctx = XSCRIPTCONTEXT.getComponentContext() # コンポーネントコンテクストの取得。
smgr = ctx.getServiceManager() # サービスマネージャーの取得。
tcu = smgr.createInstanceWithContext("pq.Tcu", ctx) # サービス名か実装名でイ... | #!/opt/libreoffice5.4/program/python
# -*- coding: utf-8 -*-
import unohelper # オートメーションには必須(必須なのはuno)。
def macro():
ctx = XSCRIPTCONTEXT.getComponentContext() # コンポーネントコンテクストの取得。
smgr = ctx.getServiceManager() # サービスマネージャーの取得。
tcu = smgr.createInstanceWithContext("pq.Tcu", ctx) # サービス名か実装名でインスタンス化。
print("\n"... | ja | 0.998179 | #!/opt/libreoffice5.4/program/python # -*- coding: utf-8 -*- # オートメーションには必須(必須なのはuno)。 # コンポーネントコンテクストの取得。 # サービスマネージャーの取得。 # サービス名か実装名でインスタンス化。 #マクロセレクターに限定表示させる関数をタプルで指定。 # オートメーションで実行するとき # オートメーションのためにglobalに出すのはこの関数のみにする。 # funcの前後でOffice接続の処理 # LibreOfficeをバックグラウンドで起動してコンポーネントテクストとサービスマネジャーを取得する。 # コンポーネントコンテクストの... | 2.115169 | 2 |
last_char.py | AkhilaSaiBejjarapu/Python | 0 | 11768 | word=input()
last_letter=(len(word)-1)
result=word[last_letter]
print(result) | word=input()
last_letter=(len(word)-1)
result=word[last_letter]
print(result) | none | 1 | 3.826098 | 4 | |
simple_retry/decorators.py | nicolasmota/retry_decorator | 11 | 11769 | <filename>simple_retry/decorators.py
import time
from functools import wraps
import asyncio
from simple_retry.simple_retry.helpers import (
format_retry_message,
has_retries_to_go,
log_message
)
def retry(Except, retries=5, delay=0, logger=None, level='info', multiple=1):
def deco_retry(function):... | <filename>simple_retry/decorators.py
import time
from functools import wraps
import asyncio
from simple_retry.simple_retry.helpers import (
format_retry_message,
has_retries_to_go,
log_message
)
def retry(Except, retries=5, delay=0, logger=None, level='info', multiple=1):
def deco_retry(function):... | none | 1 | 2.568953 | 3 | |
environment.py | bopopescu/cbrc-devteam-blog | 0 | 11770 | <filename>environment.py
# application environment
import settings
import sys
sys.path.append(settings.app_home_dir)
sys.path.append(settings.app_settings["app_lib_dir"])
| <filename>environment.py
# application environment
import settings
import sys
sys.path.append(settings.app_home_dir)
sys.path.append(settings.app_settings["app_lib_dir"])
| en | 0.867202 | # application environment | 1.724945 | 2 |
cogeo_mosaic/backends/base.py | drnextgis/cogeo-mosaic | 0 | 11771 | <reponame>drnextgis/cogeo-mosaic<filename>cogeo_mosaic/backends/base.py<gh_stars>0
"""cogeo_mosaic.backend.base: base Backend class."""
import abc
import itertools
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union
import attr
import mercantile
from cachetools import TTLCache, cached
from cach... | """cogeo_mosaic.backend.base: base Backend class."""
import abc
import itertools
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union
import attr
import mercantile
from cachetools import TTLCache, cached
from cachetools.keys import hashkey
from morecantile import TileMatrixSet
from rio_tiler.con... | en | 0.503207 | cogeo_mosaic.backend.base: base Backend class. Base Class for cogeo-mosaic backend storage. Attributes: path (str): mosaic path. mosaic_def (MosaicJSON, optional): mosaicJSON document. reader (rio_tiler.io.BaseReader): Dataset reader. Defaults to `rio_tiler.io.COGReader`. reader_opt... | 2.161595 | 2 |
userge/core/methods/decorators/on_filters.py | wildyvpn-network/bot | 0 | 11772 | # pylint: disable=missing-module-docstring
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LIC... | # pylint: disable=missing-module-docstring
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LIC... | en | 0.638786 | # pylint: disable=missing-module-docstring # # Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LIC... | 2.179924 | 2 |
pygromos/tests/test_submission/test_hpc_queuing_submission_scheduling.py | pultar/PyGromosTools | 13 | 11773 | import unittest, tempfile
from pygromos.simulations.hpc_queuing.job_scheduling.schedulers import simulation_scheduler
from pygromos.data.simulation_parameters_templates import template_md
from pygromos.data.topology_templates import blank_topo_template
from pygromos.simulations.hpc_queuing.submission_systems import D... | import unittest, tempfile
from pygromos.simulations.hpc_queuing.job_scheduling.schedulers import simulation_scheduler
from pygromos.data.simulation_parameters_templates import template_md
from pygromos.data.topology_templates import blank_topo_template
from pygromos.simulations.hpc_queuing.submission_systems import D... | none | 1 | 1.883978 | 2 | |
tutorials.py | Xython/pattern-matching | 20 | 11774 | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 30 17:03:01 2017
@author: misakawa
"""
from pattern_matching import Match, when, var, T, t, _, overwrite
from numpy.random import randint
@overwrite(var[(t == int) | (t == float)], var[(t == int) | (t == float)])
def add(a, b):
return a + b
@when(var[t == str], v... | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 30 17:03:01 2017
@author: misakawa
"""
from pattern_matching import Match, when, var, T, t, _, overwrite
from numpy.random import randint
@overwrite(var[(t == int) | (t == float)], var[(t == int) | (t == float)])
def add(a, b):
return a + b
@when(var[t == str], v... | en | 0.777483 | # -*- coding: utf-8 -*- Created on Sat Dec 30 17:03:01 2017 @author: misakawa | 3.064354 | 3 |
RepositoryBootstrap/EnvironmentDiffs.py | davidbrownell/v3-Common_Environment | 0 | 11775 | # ----------------------------------------------------------------------
# |
# | EnvironmentDiffs.py
# |
# | <NAME> <<EMAIL>>
# | 2018-06-02 22:19:34
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018-22.
# | Distributed under the Boost Software... | # ----------------------------------------------------------------------
# |
# | EnvironmentDiffs.py
# |
# | <NAME> <<EMAIL>>
# | 2018-06-02 22:19:34
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018-22.
# | Distributed under the Boost Software... | en | 0.168607 | # ---------------------------------------------------------------------- # | # | EnvironmentDiffs.py # | # | <NAME> <<EMAIL>> # | 2018-06-02 22:19:34 # | # ---------------------------------------------------------------------- # | # | Copyright <NAME> 2018-22. # | Distributed under the Boost Software License, ... | 1.607562 | 2 |
tests/model/test_ocrd_mets.py | wrznr/pyocrd | 0 | 11776 | from datetime import datetime
from os.path import join
from tests.base import TestCase, main, assets, copy_of_directory
from ocrd_utils import (
initLogging,
VERSION,
MIMETYPE_PAGE
)
from ocrd_models import OcrdMets
# pylint: disable=protected-access,deprecated-method,too-many-public-methods
class TestOcr... | from datetime import datetime
from os.path import join
from tests.base import TestCase, main, assets, copy_of_directory
from ocrd_utils import (
initLogging,
VERSION,
MIMETYPE_PAGE
)
from ocrd_models import OcrdMets
# pylint: disable=protected-access,deprecated-method,too-many-public-methods
class TestOcr... | en | 0.434889 | # pylint: disable=protected-access,deprecated-method,too-many-public-methods # Processor(workspace=self.workspace) # print(['%s'%x for x in mets.agents]) Test whether metsHdr is created on-demand <mets> <metsHdr> <agent> <name>Őh śéé Áŕ</name> <note>OCR-D</note> ... | 2.218156 | 2 |
robo_gym/envs/ur/ur_avoidance_basic.py | psFournier/robo-gym | 236 | 11777 | """
Environment for basic obstacle avoidance controlling a robotic arm from UR.
In this environment the obstacle is only moving up and down in a vertical line in front of the robot.
The goal is for the robot to stay within a predefined minimum distance to the moving obstacle.
When feasible the robot should continue to... | """
Environment for basic obstacle avoidance controlling a robotic arm from UR.
In this environment the obstacle is only moving up and down in a vertical line in front of the robot.
The goal is for the robot to stay within a predefined minimum distance to the moving obstacle.
When feasible the robot should continue to... | en | 0.810628 | Environment for basic obstacle avoidance controlling a robotic arm from UR. In this environment the obstacle is only moving up and down in a vertical line in front of the robot. The goal is for the robot to stay within a predefined minimum distance to the moving obstacle. When feasible the robot should continue to the... | 3.689939 | 4 |
hear_me_django_app/accounts/management/commands/initial_users.py | kamil1marczak/hear_me_django_app | 0 | 11778 | <filename>hear_me_django_app/accounts/management/commands/initial_users.py
from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import make_password
from django.core.management.base import BaseCommand
from ._private import populate_user
User = get_user_model()
class Command(BaseCommand):
... | <filename>hear_me_django_app/accounts/management/commands/initial_users.py
from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import make_password
from django.core.management.base import BaseCommand
from ._private import populate_user
User = get_user_model()
class Command(BaseCommand):
... | none | 1 | 2.275378 | 2 | |
config/constants.py | flopezag/fiware-tsc-dashboard | 0 | 11779 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##
# Copyright 2017 FIWARE Foundation, e.V.
# 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.apach... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##
# Copyright 2017 FIWARE Foundation, e.V.
# 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.apach... | en | 0.782312 | #!/usr/bin/env python # -*- encoding: utf-8 -*- ## # Copyright 2017 FIWARE Foundation, e.V. # 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.apach... | 1.302352 | 1 |
tensornetwork/backends/backend_test.py | ashoknar/TensorNetwork | 0 | 11780 | <gh_stars>0
"""Tests for graphmode_tensornetwork."""
import builtins
import sys
import pytest
import numpy as np
from tensornetwork import connect, contract, Node
from tensornetwork.backends.base_backend import BaseBackend
from tensornetwork.backends import backend_factory
def clean_tensornetwork_modules():
for mod... | """Tests for graphmode_tensornetwork."""
import builtins
import sys
import pytest
import numpy as np
from tensornetwork import connect, contract, Node
from tensornetwork.backends.base_backend import BaseBackend
from tensornetwork.backends import backend_factory
def clean_tensornetwork_modules():
for mod in list(sys... | en | 0.488413 | Tests for graphmode_tensornetwork. #never do this outside testing # use as teardown # pylint: disable=redefined-builtin # Nuke the cache. #pylint: disable=import-outside-toplevel # pylint: disable=import-outside-toplevel #pylint: disable=import-outside-toplevel # pylint: disable=import-outside-toplevel #pylint: disable... | 2.051669 | 2 |
src/GUI/Plotter.py | sbooeshaghi/pegasus | 1 | 11781 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pyqtgraph as pg
import numpy as np
class CustomWidget(pg.GraphicsWindow):
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
def __init__(self, parent=None, **kargs):
pg.GraphicsWindow.__init__(self, **kargs)
sel... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pyqtgraph as pg
import numpy as np
class CustomWidget(pg.GraphicsWindow):
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
def __init__(self, parent=None, **kargs):
pg.GraphicsWindow.__init__(self, **kargs)
sel... | en | 0.352855 | #!/usr/bin/env python # -*- coding: utf-8 -*- | 3.066359 | 3 |
tests/test_collapsible.py | TehMillhouse/sphinxawesome-theme | 17 | 11782 | """Tests for collapsible definition lists.
When the option ``html_collapsible_definitions``
is ``True``, some HTML classes should be added
to some definition lists but not all of them.
"""
from pathlib import Path
import pytest
from sphinx.application import Sphinx
from .util import parse_html
@pytest.mark.sphinx... | """Tests for collapsible definition lists.
When the option ``html_collapsible_definitions``
is ``True``, some HTML classes should be added
to some definition lists but not all of them.
"""
from pathlib import Path
import pytest
from sphinx.application import Sphinx
from .util import parse_html
@pytest.mark.sphinx... | en | 0.75374 | Tests for collapsible definition lists. When the option ``html_collapsible_definitions`` is ``True``, some HTML classes should be added to some definition lists but not all of them. It tests that there are no permalinks. # type: ignore[attr-defined] By default, no classes should be added. It tests the correct classes ... | 2.620263 | 3 |
Iris Network/Conclusion/task.py | jetbrains-academy/Machine-Learning-101 | 0 | 11783 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from network import NN
from evaluate import accuracy
def read_data(fpath):
iris = pd.read_csv(fpath)
iris.loc[iris['species'] == 'virginica', 'species'] = 0
iris.loc[iris['species'] == 'versicolor', 'species'] = 1
iris.loc[iris['sp... | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from network import NN
from evaluate import accuracy
def read_data(fpath):
iris = pd.read_csv(fpath)
iris.loc[iris['species'] == 'virginica', 'species'] = 0
iris.loc[iris['species'] == 'versicolor', 'species'] = 1
iris.loc[iris['sp... | en | 0.957501 | # comment the following line if you don't need the plot anymore | 3.079294 | 3 |
agentless/crypto.py | tinyauth/agentless | 0 | 11784 | <gh_stars>0
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa
backend = default_backend()
def generate_private_key():
key = rsa.generate_private_key(
public_exponent=... | from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa
backend = default_backend()
def generate_private_key():
key = rsa.generate_private_key(
public_exponent=65537,
... | none | 1 | 2.594993 | 3 | |
test/programytest/storage/entities/test_nodes.py | cdoebler1/AIML2 | 345 | 11785 | import unittest
import unittest.mock
from programy.storage.entities.nodes import NodesStore
class NodesStoreTest(unittest.TestCase):
def test_load(self):
store = NodesStore()
with self.assertRaises(NotImplementedError):
collector = unittest.mock.Mock()
store.load(collecto... | import unittest
import unittest.mock
from programy.storage.entities.nodes import NodesStore
class NodesStoreTest(unittest.TestCase):
def test_load(self):
store = NodesStore()
with self.assertRaises(NotImplementedError):
collector = unittest.mock.Mock()
store.load(collecto... | none | 1 | 2.644356 | 3 | |
sphinx/source/tutorial/exercises/stocks.py | minrk/bokeh | 0 | 11786 | <reponame>minrk/bokeh
import numpy as np
import pandas as pd
from bokeh.plotting import *
# Here is some code to read in some stock data from the Yahoo Finance API
AAPL = pd.read_csv(
"http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000",
parse_dates=['Date'])
GOOG = pd.read_csv(
"http://ichart.yahoo... | import numpy as np
import pandas as pd
from bokeh.plotting import *
# Here is some code to read in some stock data from the Yahoo Finance API
AAPL = pd.read_csv(
"http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000",
parse_dates=['Date'])
GOOG = pd.read_csv(
"http://ichart.yahoo.com/table.csv?s=GOOG&a... | en | 0.838589 | # Here is some code to read in some stock data from the Yahoo Finance API # EXERCISE: turn on plot hold # EXERCISE: finish this line plot, and add more for the other stocks. Each one should # have a legend, and its own color. # x coordinates # y coordinates # set a color for the line # attach a legend label # NOTE: onl... | 3.329197 | 3 |
nni/retiarii/converter/visualize.py | qfyin/nni | 3 | 11787 | import graphviz
def convert_to_visualize(graph_ir, vgraph):
for name, graph in graph_ir.items():
if name == '_training_config':
continue
with vgraph.subgraph(name='cluster'+name) as subgraph:
subgraph.attr(color='blue')
cell_node = {}
ioput = {'_inpu... | import graphviz
def convert_to_visualize(graph_ir, vgraph):
for name, graph in graph_ir.items():
if name == '_training_config':
continue
with vgraph.subgraph(name='cluster'+name) as subgraph:
subgraph.attr(color='blue')
cell_node = {}
ioput = {'_inpu... | none | 1 | 2.75454 | 3 | |
Python/Tests/TestData/TestDiscoverer/ConfigUnittest/Product/prefix_not_included.py | techkey/PTVS | 404 | 11788 | import unittest
class PrefixNotIncluded(unittest.TestCase):
def test_not_included(self):
pass
if __name__ == '__main__':
unittest.main()
| import unittest
class PrefixNotIncluded(unittest.TestCase):
def test_not_included(self):
pass
if __name__ == '__main__':
unittest.main()
| none | 1 | 1.813222 | 2 | |
customBackground.py | VisweshK/Jashmup | 0 | 11789 | '''
This is the class to create a scrolling background.
Because the background was so large, it was made to be a .jpg.
'''
import pygame, os
class Background(pygame.sprite.Sprite):
# Initialize the sprite.
def __init__(self,disp):
pygame.sprite.Sprite.__init__(self)
self.image = pygame... | '''
This is the class to create a scrolling background.
Because the background was so large, it was made to be a .jpg.
'''
import pygame, os
class Background(pygame.sprite.Sprite):
# Initialize the sprite.
def __init__(self,disp):
pygame.sprite.Sprite.__init__(self)
self.image = pygame... | en | 0.906516 | This is the class to create a scrolling background. Because the background was so large, it was made to be a .jpg. # Initialize the sprite. # Constantly have the sprite move to the left. # If the right side of the image moves beyond the right side of the screen, reset the image. # Reset the image's left side to the... | 3.923297 | 4 |
src/python/squarepants/file_utils.py | ericzundel/mvn2pants | 8 | 11790 | <filename>src/python/squarepants/file_utils.py
import os
import shutil
from contextlib import contextmanager
from tempfile import mkdtemp, mktemp
@contextmanager
def temporary_dir():
"""Returns a temporary directory that gets cleaned up when the context manager exits."""
tempdir = mkdtemp()
try:
yield tempd... | <filename>src/python/squarepants/file_utils.py
import os
import shutil
from contextlib import contextmanager
from tempfile import mkdtemp, mktemp
@contextmanager
def temporary_dir():
"""Returns a temporary directory that gets cleaned up when the context manager exits."""
tempdir = mkdtemp()
try:
yield tempd... | en | 0.837372 | Returns a temporary directory that gets cleaned up when the context manager exits. Returns a temporary file that gets cleaned up when the context manager exits. Ensures that the contents of the directory are the same after exiting as before entering. Search for a file pattern recursively in a subdirectory :param sub... | 3.212541 | 3 |
docs/DSDC/miniprez/miniprez/continuous_integration.py | thoppe/Presentation_Topics | 2 | 11791 | <filename>docs/DSDC/miniprez/miniprez/continuous_integration.py<gh_stars>1-10
import asyncio
import os
from parser import miniprez_markdown, build_body
import logging
logger = logging.getLogger("miniprez")
async def file_watcher(target_file, sleep_time=0.5):
"""
Watchs a file. If modified, yield the filenam... | <filename>docs/DSDC/miniprez/miniprez/continuous_integration.py<gh_stars>1-10
import asyncio
import os
from parser import miniprez_markdown, build_body
import logging
logger = logging.getLogger("miniprez")
async def file_watcher(target_file, sleep_time=0.5):
"""
Watchs a file. If modified, yield the filenam... | en | 0.726854 | Watchs a file. If modified, yield the filename. Yield the filename once to start. # Yield the file first Main event loop. If the target file is modified, or new start a build. Build the html from the markdown. | 2.780139 | 3 |
rl_algorithms/dqn/linear.py | yonghangzhou/rl_algorithms | 1 | 11792 | # -*- coding: utf-8 -*-
"""Linear module for dqn algorithms
- Author: <NAME>
- Contact: <EMAIL>
"""
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from rl_algorithms.common.helper_functions import numpy2floattensor
device = torch.device("cuda:0" if torch.cuda.is_a... | # -*- coding: utf-8 -*-
"""Linear module for dqn algorithms
- Author: <NAME>
- Contact: <EMAIL>
"""
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from rl_algorithms.common.helper_functions import numpy2floattensor
device = torch.device("cuda:0" if torch.cuda.is_a... | en | 0.396059 | # -*- coding: utf-8 -*- Linear module for dqn algorithms - Author: <NAME> - Contact: <EMAIL> Noisy linear module for NoisyNet. References: https://github.com/higgsfield/RL-Adventure/blob/master/5.noisy%20dqn.ipynb https://github.com/Kaixhin/Rainbow/blob/master/model.py Attributes: in_... | 2.805131 | 3 |
2015/day7/2015-day7-part2.py | matt-the-ogre/advent-of-code | 1 | 11793 | # Advent of Code - 2015 - Day 7
# --- Day 7: Some Assembly Required ---
# This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit.
# Each wire has an identifier (some lowerca... | # Advent of Code - 2015 - Day 7
# --- Day 7: Some Assembly Required ---
# This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit.
# Each wire has an identifier (some lowerca... | en | 0.831839 | # Advent of Code - 2015 - Day 7 # --- Day 7: Some Assembly Required --- # This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit. # Each wire has an identifier (some lowercase ... | 3.48872 | 3 |
flink-ai-flow/examples/workflow_on_event/workflows/init/init.py | lisy09/flink-ai-extended | 0 | 11794 | <reponame>lisy09/flink-ai-extended
#
# 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... | #
# 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 (the
# "License"); you may not... | en | 0.86503 | # # 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 (the # "License"); you may not... | 1.822938 | 2 |
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/bobcat/profiles/Profile_WiSUN.py | SiliconLabs/Gecko_SDK | 82 | 11795 | <filename>platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/bobcat/profiles/Profile_WiSUN.py
from pyradioconfig.parts.ocelot.profiles.Profile_WiSUN import Profile_WiSUN_Ocelot
from pyradioconfig.parts.common.profiles.bobcat_regs import build_modem_regs_bobcat
from pyradioconfig.parts.common.profiles.profil... | <filename>platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/bobcat/profiles/Profile_WiSUN.py
from pyradioconfig.parts.ocelot.profiles.Profile_WiSUN import Profile_WiSUN_Ocelot
from pyradioconfig.parts.common.profiles.bobcat_regs import build_modem_regs_bobcat
from pyradioconfig.parts.common.profiles.profil... | none | 1 | 1.973271 | 2 | |
tests/dgds_functions_test.py | openearth/hydro-engine-service | 4 | 11796 | import logging
import pytest
from . import auth
from hydroengine_service import dgds_functions
logger = logging.getLogger(__name__)
class TestDGDSFunctions:
@pytest.mark.parametrize('source, start_date, end_date, limit',
[
('projects/dgds-gee/bathym... | import logging
import pytest
from . import auth
from hydroengine_service import dgds_functions
logger = logging.getLogger(__name__)
class TestDGDSFunctions:
@pytest.mark.parametrize('source, start_date, end_date, limit',
[
('projects/dgds-gee/bathym... | none | 1 | 2.175614 | 2 | |
smol_opyt/logistic_problem.py | abelsiqueira/smol-opyt | 0 | 11797 | <filename>smol_opyt/logistic_problem.py
from math import log
import numpy as np
from numpy import linalg as la
class LogisticProblem:
"""Class for the logistic regression method for classification."""
def __init__(self, feat_mtx, y):
"""Create a Logistic Problem with matrix `feat_mtx` n by p and vecto... | <filename>smol_opyt/logistic_problem.py
from math import log
import numpy as np
from numpy import linalg as la
class LogisticProblem:
"""Class for the logistic regression method for classification."""
def __init__(self, feat_mtx, y):
"""Create a Logistic Problem with matrix `feat_mtx` n by p and vecto... | en | 0.851567 | Class for the logistic regression method for classification. Create a Logistic Problem with matrix `feat_mtx` n by p and vector `y` of 0s and 1s with size n. A bias is added to the model as the first variable. Compute sigmoid(v) = 1 / (1 + exp(-v) Compute the cross entropy, given by sum y[i] * log(... | 3.471021 | 3 |
TeamClassificationUtils.py | Neerajj9/Computer-Vision-based-Offside-Detection-in-soccer | 8 | 11798 | <gh_stars>1-10
import numpy as np
# TODO : add code for referee
def get_team_classifications(teamColor1, teamColor2, refColor, keeper1Color, keeper2Color, pose_estimations):
for pose in pose_estimations:
if len(pose[1]) < 2:
pose.append('color not found')
continue
c... | import numpy as np
# TODO : add code for referee
def get_team_classifications(teamColor1, teamColor2, refColor, keeper1Color, keeper2Color, pose_estimations):
for pose in pose_estimations:
if len(pose[1]) < 2:
pose.append('color not found')
continue
colorDiffs = {}
... | en | 0.461981 | # TODO : add code for referee | 2.455251 | 2 |
examples/PTSD/mpi_tmp/PTSD_cognet.py | zeroknowledgediscovery/cognet | 0 | 11799 | <gh_stars>0
from mpi4py.futures import MPIPoolExecutor
import numpy as np
import pandas as pd
from quasinet.qnet import Qnet, qdistance, load_qnet, qdistance_matrix
from quasinet.qsampling import qsample, targeted_qsample
qnet=load_qnet('../results/PTSD_cognet_test.joblib')
w = 304
h = w
p_all = pd.read_csv("tmp_sampl... | from mpi4py.futures import MPIPoolExecutor
import numpy as np
import pandas as pd
from quasinet.qnet import Qnet, qdistance, load_qnet, qdistance_matrix
from quasinet.qsampling import qsample, targeted_qsample
qnet=load_qnet('../results/PTSD_cognet_test.joblib')
w = 304
h = w
p_all = pd.read_csv("tmp_samples_as_string... | none | 1 | 2.518667 | 3 |