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 |
|---|---|---|---|---|---|---|---|---|---|---|
naver_oauth/user/oauth/providers/naver.py | bluebamus/django_miscellaneous_book | 0 | 6622651 | <filename>naver_oauth/user/oauth/providers/naver.py
from django.conf import settings
from django.contrib.auth import login
import requests
class SingletonInstane:
__instance = None
@classmethod
def __getInstance(cls):
return cls.__instance
@classmethod
def instance(cls, *args, **kargs):
cls.__inst... | <filename>naver_oauth/user/oauth/providers/naver.py
from django.conf import settings
from django.contrib.auth import login
import requests
class SingletonInstane:
__instance = None
@classmethod
def __getInstance(cls):
return cls.__instance
@classmethod
def instance(cls, *args, **kargs):
cls.__inst... | ko | 0.999866 | # singleton 이라는 패턴 사용 # 첫번째 생성자 호출 때만 객체만 생성시키고 이후 생성자 호출부터는 먼저 생성된 객체를 공유하게 하는 방식 # NaverClient 클래스를 NaverLoginMixin 뿐만 아니라 다른 클래스에서도 공유하며 사용할 수 있습니다. # NaverClient 객체는 인스턴스변수가 없기 때문에 하나의 객체를 서로 공유하더라도 문제가 발생하지 않습니다. # 이렇게 인스턴스변수가 존재하지 않으나 여러 클래스에서 유틸리티처럼 사용하는 클래스의 경우 # 싱글턴 패턴을 많이 사용합니다. # 객체를 생성하는 비용이 줄어 서버의 가용성을 높이는... | 2.04624 | 2 |
documentation/models/DOC_HSE.py | ElNahoko/HSE_ARNOSH | 1 | 6622652 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class DOCHSE(models.Model):
_name = 'document'
_rec_name = 'categorie'
categorie = fields.Many2one(
'document.categorie',
string="Catégorie",
required=False, )
description = fields.Char(
strin... | # -*- coding: utf-8 -*-
from odoo import models, fields, api
class DOCHSE(models.Model):
_name = 'document'
_rec_name = 'categorie'
categorie = fields.Many2one(
'document.categorie',
string="Catégorie",
required=False, )
description = fields.Char(
string="Description"... | en | 0.769321 | # -*- coding: utf-8 -*- | 2.089961 | 2 |
tuenti/tuenti_challenge_4/qualification/3_gambler_cup/gambler_cup.py | GMadorell/programming-challenges | 0 | 6622653 | #!/usr/bin/env python
"""
Problem description.
"""
from __future__ import division
import sys
import math
class GamblerCupSolver(object):
def __init__(self, output_file=sys.stdout):
self.__output_file = output_file
def solve(self, instances):
solutions = []
for instance in instances:... | #!/usr/bin/env python
"""
Problem description.
"""
from __future__ import division
import sys
import math
class GamblerCupSolver(object):
def __init__(self, output_file=sys.stdout):
self.__output_file = output_file
def solve(self, instances):
solutions = []
for instance in instances:... | en | 0.621619 | #!/usr/bin/env python Problem description. This method should populate the instances list. | 3.219369 | 3 |
machina/apps/forum/receivers.py | OneRainbowDev/django-machina | 1 | 6622654 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models import F
from django.dispatch import receiver
from machina.apps.forum.signals import forum_viewed
@receiver(forum_viewed)
def update_forum_redirects_counter(sender, forum, user, request, response, **kwargs):
"""
Receiver ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models import F
from django.dispatch import receiver
from machina.apps.forum.signals import forum_viewed
@receiver(forum_viewed)
def update_forum_redirects_counter(sender, forum, user, request, response, **kwargs):
"""
Receiver ... | en | 0.887596 | # -*- coding: utf-8 -*- Receiver to handle the update of the link redirects counter associated with link forums. | 2.045086 | 2 |
game/utils/files.py | m4tx/hackthespace | 8 | 6622655 | import shutil
def cat_files(out_path: str, *in_files: str):
with open(out_path, 'wb') as out_file:
for in_path in in_files:
with open(in_path, 'rb') as in_file:
shutil.copyfileobj(in_file, out_file)
| import shutil
def cat_files(out_path: str, *in_files: str):
with open(out_path, 'wb') as out_file:
for in_path in in_files:
with open(in_path, 'rb') as in_file:
shutil.copyfileobj(in_file, out_file)
| none | 1 | 2.750143 | 3 | |
text_blind_watermark/text_blind_watermark.py | guofei9987/blind_watermark_text | 53 | 6622656 | import random
class TextBlindWatermark:
def __init__(self, password):
self.password = password
self.text, self.wm_bin = None, None
def read_wm(self, watermark):
random.seed(self.password)
wm_bin = [format(i ^ random.randint(0, 255), '08b') for i in watermark.encode('utf-8')] ... | import random
class TextBlindWatermark:
def __init__(self, password):
self.password = password
self.text, self.wm_bin = None, None
def read_wm(self, watermark):
random.seed(self.password)
wm_bin = [format(i ^ random.randint(0, 255), '08b') for i in watermark.encode('utf-8')] ... | zh | 0.901575 | # 8位2进制格式 # 头尾各放一个1。提取过程中把首尾的0去掉。 # 打入水印 # TODO:循环嵌入 # 8位2进制格式 # 头尾各放一个1。提取过程中把首尾的0去掉。 # 打入水印 # TODO:循环嵌入 # 嵌入水印 | 2.876472 | 3 |
src/main.gyp | pwnall/sanctum | 49 | 6622657 | <reponame>pwnall/sanctum
{
'includes': [
'common.gypi',
],
'targets': [
{
'target_name': 'tests',
'type': 'none',
'dependencies': [
'bare/bare.gyp:bare_tests',
'crypto/crypto.gyp:crypto_tests',
'monitor/monitor.gyp:monitor_tests',
],
},
{
'targ... | {
'includes': [
'common.gypi',
],
'targets': [
{
'target_name': 'tests',
'type': 'none',
'dependencies': [
'bare/bare.gyp:bare_tests',
'crypto/crypto.gyp:crypto_tests',
'monitor/monitor.gyp:monitor_tests',
],
},
{
'target_name': 'libs',
'... | en | 0.357274 | #'monitor/monitor.gyp:monitor', | 1.10824 | 1 |
acceptance_tests/test_full_chain.py | pleasedontbelong/raincoat | 0 | 6622658 | import traceback
import sh
from raincoat import __version__
def main():
"""
Note that this test is excluded from coverage because coverage should be
for unit tests.
"""
result = sh.raincoat(
"acceptance_tests/test_project", exclude="*ignored*",
_ok_code=1)
output = result.s... | import traceback
import sh
from raincoat import __version__
def main():
"""
Note that this test is excluded from coverage because coverage should be
for unit tests.
"""
result = sh.raincoat(
"acceptance_tests/test_project", exclude="*ignored*",
_ok_code=1)
output = result.s... | en | 0.964645 | Note that this test is excluded from coverage because coverage should be for unit tests. # space left intentionally at the end to not match the previous line #25981 has been merged in Django" in output | 2.351742 | 2 |
content/apps.py | japsu/tracontent | 0 | 6622659 | from django.apps import AppConfig
class ContentAppConfig(AppConfig):
name = 'content'
verbose_name = 'Sisältö'
| from django.apps import AppConfig
class ContentAppConfig(AppConfig):
name = 'content'
verbose_name = 'Sisältö'
| none | 1 | 1.085894 | 1 | |
taiseia101/core/base_dev_service.py | slee124565/pytwseia | 3 | 6622660 |
from .base_obj import *
import struct
import logging
logger = logging.getLogger(__name__)
class DataTypeCode(BaseObject):
"""deprecated by ValueTypeCode"""
ENUM16 = 0x01
ENUM16_BIT = 0x06
UNIT8 = 0x0a
UNIT16 = 0x0b
UINT32 = 0x0c
UINT64 = 0x0d
INT8 = 0x0f
INT16 = 0x10
INT32 ... |
from .base_obj import *
import struct
import logging
logger = logging.getLogger(__name__)
class DataTypeCode(BaseObject):
"""deprecated by ValueTypeCode"""
ENUM16 = 0x01
ENUM16_BIT = 0x06
UNIT8 = 0x0a
UNIT16 = 0x0b
UINT32 = 0x0c
UINT64 = 0x0d
INT8 = 0x0f
INT16 = 0x10
INT32 ... | en | 0.67366 | deprecated by ValueTypeCode # read or write # service_data = None # 'high_byte': self.high_byte, # 'low_byte': self.low_byte for device with data_kind_code is DeviceBaseService.DataKindCode.MULTIPLE # data_len = None # datas = None # self.high_byte = self.low_byte = None | 2.354253 | 2 |
tests/test_id_lib.py | beyond-blockchain/bbc1-lib-std | 1 | 6622661 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import pytest
import sys
import time
sys.path.extend(["../"])
from bbc1.lib import id_lib
from bbc1.lib.app_support_lib import TransactionLabel
from bbc1.core import bbc_app
from bbc1.core import bbclib
from bbc1.core.bbc_config import DEFAULT_CORE_PORT
@pytest.fixture()
def de... | # -*- coding: utf-8 -*-
import pytest
import sys
import time
sys.path.extend(["../"])
from bbc1.lib import id_lib
from bbc1.lib.app_support_lib import TransactionLabel
from bbc1.core import bbc_app
from bbc1.core import bbclib
from bbc1.core.bbc_config import DEFAULT_CORE_PORT
@pytest.fixture()
def default_domain_id... | en | 0.635209 | # -*- coding: utf-8 -*- # end of tests/test_id_lib.py | 1.857847 | 2 |
FictionTools/amitools/test/unit/libmgr_mgr.py | polluks/Puddle-BuildTools | 38 | 6622662 | import logging
import pytest
from amitools.vamos.log import log_libmgr, log_exec
from amitools.vamos.libcore import LibCtx
from amitools.vamos.libmgr import LibManager, LibMgrCfg, LibCfg
from amitools.vamos.machine import Machine
from amitools.vamos.mem import MemoryAlloc
from amitools.vamos.lib.lexec.ExecLibCtx import... | import logging
import pytest
from amitools.vamos.log import log_libmgr, log_exec
from amitools.vamos.libcore import LibCtx
from amitools.vamos.libmgr import LibManager, LibMgrCfg, LibCfg
from amitools.vamos.machine import Machine
from amitools.vamos.mem import MemoryAlloc
from amitools.vamos.lib.lexec.ExecLibCtx import... | en | 0.65299 | # machine.show_instr(True) # setup ctx map # bootstrap exec # make sure exec is in place # we can't expunge exec # shutdown # exec is now gone and mem is sane # open non-existing lib # shutdown # exec is now gone and mem is sane # make vamos test lib # shutdown # make vamos test lib # shutdown # make vamos test lib # s... | 1.798156 | 2 |
himlar_dp_prep/dp_provisioner.py | tanzr/himlar-dp-prep | 0 | 6622663 | <reponame>tanzr/himlar-dp-prep
import logging
import argparse
from keystoneclient.auth.identity import v3
from keystoneclient import session
from keystoneclient.v3 import client
from grampg import PasswordGenerator
ADMIN_NAME = 'admin'
PROJECT_NAME = 'admin'
DEFAULT_DOMAIN_NAME = 'default'
DP_DOMAIN_NAME = 'dataporten... | import logging
import argparse
from keystoneclient.auth.identity import v3
from keystoneclient import session
from keystoneclient.v3 import client
from grampg import PasswordGenerator
ADMIN_NAME = 'admin'
PROJECT_NAME = 'admin'
DEFAULT_DOMAIN_NAME = 'default'
DP_DOMAIN_NAME = 'dataporten'
MEMBER_ROLE_NAME = '_member_'... | none | 1 | 2.20003 | 2 | |
model/app/__init__.py | Temiloluwa/language-modelling | 0 | 6622664 | <filename>model/app/__init__.py<gh_stars>0
from flask import Flask
from flask_restful import Api
from flask_cors import CORS
app = Flask(__name__)
api = Api(app)
cors = CORS(app, resources={r"/generatewords": {"origins": "*"}})
from app import views | <filename>model/app/__init__.py<gh_stars>0
from flask import Flask
from flask_restful import Api
from flask_cors import CORS
app = Flask(__name__)
api = Api(app)
cors = CORS(app, resources={r"/generatewords": {"origins": "*"}})
from app import views | none | 1 | 1.878348 | 2 | |
Desafios 2/m01/ex035.py | joaquimjfernandes/Curso-de-Python | 0 | 6622665 | print('\033[32;1mDESAFIO 35 - Analisando Triângulos\033[m')
print('\033[32;1mALUNO:\033[m \033[36;1m<NAME>\033[m')
print('-=' * 20)
print(' \033[34;1mANALISADOR DE TRIÂNGULO\033[m')
print('-=' * 20)
r1 = float(input('Primeiro Segmento: '))
r2 = float(input('Segundo Segmento: '))
r3 = float(input('Terceiro Segmento: '))... | print('\033[32;1mDESAFIO 35 - Analisando Triângulos\033[m')
print('\033[32;1mALUNO:\033[m \033[36;1m<NAME>\033[m')
print('-=' * 20)
print(' \033[34;1mANALISADOR DE TRIÂNGULO\033[m')
print('-=' * 20)
r1 = float(input('Primeiro Segmento: '))
r2 = float(input('Segundo Segmento: '))
r3 = float(input('Terceiro Segmento: '))... | none | 1 | 3.829519 | 4 | |
scrappers/parser.py | foukonana/news_media_scrappers | 2 | 6622666 | import gc
import re
import numpy as np
from tqdm import tqdm
from requests import get
from bs4 import BeautifulSoup
class base_parser():
def __init__(self):
self.article_links = []
self.article_main_bodies = []
self.article_titles = []
self.article_subtitles = []
self.art... | import gc
import re
import numpy as np
from tqdm import tqdm
from requests import get
from bs4 import BeautifulSoup
class base_parser():
def __init__(self):
self.article_links = []
self.article_main_bodies = []
self.article_titles = []
self.article_subtitles = []
self.art... | en | 0.478683 | # clear the lists again to avoid memory issues # write the data into parts # remove HTML from text # there is no update/ modification time for articles in Kontra # example usage # # parser = kontra() # kontra.save_articles(links_df = df, filename = f"data/kontra_part_{i}.csv") # | 2.616316 | 3 |
tests/test_init.py | neroks/mutmut | 0 | 6622667 | <reponame>neroks/mutmut
from pytest import raises
from mutmut import (
partition_node_list,
name_mutation,
Context,
)
def test_partition_node_list_no_nodes():
with raises(AssertionError):
partition_node_list([], None)
def test_name_mutation_simple_mutants():
assert name_mutation(None, 'T... | from pytest import raises
from mutmut import (
partition_node_list,
name_mutation,
Context,
)
def test_partition_node_list_no_nodes():
with raises(AssertionError):
partition_node_list([], None)
def test_name_mutation_simple_mutants():
assert name_mutation(None, 'True') == 'False'
def t... | none | 1 | 2.11923 | 2 | |
main.py | CalebABG/VMU931-IMU | 0 | 6622668 | <filename>main.py
#!/usr/bin/python
"""
Project relies on PySerial package
- pip install pyserial
- https://pypi.org/project/pyserial/
Python 2 and 3 Compatibility:
- pip install future
- https://python-future.org/compatible_idioms.html
"""
import serial
import vmu931_utils
import signal
import sys
i... | <filename>main.py
#!/usr/bin/python
"""
Project relies on PySerial package
- pip install pyserial
- https://pypi.org/project/pyserial/
Python 2 and 3 Compatibility:
- pip install future
- https://python-future.org/compatible_idioms.html
"""
import serial
import vmu931_utils
import signal
import sys
i... | en | 0.466946 | #!/usr/bin/python Project relies on PySerial package - pip install pyserial - https://pypi.org/project/pyserial/ Python 2 and 3 Compatibility: - pip install future - https://python-future.org/compatible_idioms.html # milliseconds # serial.Serial(port='COM8', baudrate=115200, timeout=1, rtscts=1) # Ctrl... | 2.908463 | 3 |
cart/urls.py | doctsystems/jaguarete-ecommerce | 0 | 6622669 | from django.urls import path
from .views import cart_add, cart_detalle, cart_eliminar, cart_clear
urlpatterns = [
path("", cart_detalle, name="detalle"),
path("add/<int:producto_id>/", cart_add, name="add"),
path("eliminar/<int:producto_id>/", cart_eliminar, name="eliminar"),
path("clear/", cart_clear, name=... | from django.urls import path
from .views import cart_add, cart_detalle, cart_eliminar, cart_clear
urlpatterns = [
path("", cart_detalle, name="detalle"),
path("add/<int:producto_id>/", cart_add, name="add"),
path("eliminar/<int:producto_id>/", cart_eliminar, name="eliminar"),
path("clear/", cart_clear, name=... | none | 1 | 1.56714 | 2 | |
quots/migrations/0004_auto_20170402_1832.py | GSByeon/openhgsenti | 29 | 6622670 | <reponame>GSByeon/openhgsenti
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-04-02 09:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('quots', '0003_auto_20170402_1... | # -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-04-02 09:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('quots', '0003_auto_20170402_1826'),
]
operations =... | en | 0.804655 | # -*- coding: utf-8 -*- # Generated by Django 1.11b1 on 2017-04-02 09:32 | 1.42063 | 1 |
src/api.py | computer-geek64/swamphacks | 0 | 6622671 | #!/usr/bin/python3
# api.py
import os
import json
import math
import gmplot
import pymongo
from datetime import datetime
from data import mongo
from data import predict
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
from flask import Flask, jsonify, redirect, request, render_templa... | #!/usr/bin/python3
# api.py
import os
import json
import math
import gmplot
import pymongo
from datetime import datetime
from data import mongo
from data import predict
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
from flask import Flask, jsonify, redirect, request, render_templa... | en | 0.290383 | #!/usr/bin/python3 # api.py # Home # API Endpoint # Update Location # Get users in danger # Get plotting coordinate points # return jsonify(json_response), 200 # Error handlers | 2.464311 | 2 |
website.py | SurajMalpani/Movie-Trailer-website | 0 | 6622672 | import media # import media.py file to access the class Movie definitions
import fresh_tomatoes # import fresh_tomatoes.py file to generate webpage
argo = media.Movie("Argo",
"Acting under the cover of a Hollywood producer scouting a "
"location for a science fiction film,... | import media # import media.py file to access the class Movie definitions
import fresh_tomatoes # import fresh_tomatoes.py file to generate webpage
argo = media.Movie("Argo",
"Acting under the cover of a Hollywood producer scouting a "
"location for a science fiction film,... | en | 0.474773 | # import media.py file to access the class Movie definitions # import fresh_tomatoes.py file to generate webpage # NOQA # NOQA # NOQA # NOQA # NOQA # NOQA | 3.178295 | 3 |
AtCoder/ABC106/D.py | takaaki82/Java-Lessons | 1 | 6622673 | <reponame>takaaki82/Java-Lessons
N, M, Q = map(int, input().split())
x = [[0 for i in range(N + 1)] for j in range(N + 1)]
for i in range(M):
l, r = map(int, input().split())
x[l][r] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
x[i][j] += x[i - 1][j] + x[i][j - 1] - x[i - 1][j - 1]... | N, M, Q = map(int, input().split())
x = [[0 for i in range(N + 1)] for j in range(N + 1)]
for i in range(M):
l, r = map(int, input().split())
x[l][r] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
x[i][j] += x[i - 1][j] + x[i][j - 1] - x[i - 1][j - 1]
for i in range(Q):
p, q = ... | none | 1 | 2.553685 | 3 | |
snoopy/apps.py | Pradeek/django-snoopy | 5 | 6622674 | <reponame>Pradeek/django-snoopy
from django.apps import AppConfig
class SnoopyConfig(AppConfig):
name = 'snoopy'
verbose_name = "Snoopy"
| from django.apps import AppConfig
class SnoopyConfig(AppConfig):
name = 'snoopy'
verbose_name = "Snoopy" | none | 1 | 1.327677 | 1 | |
lm-tools/interpolate-lm.py | senarvi/senarvi-speech | 6 | 6622675 | <filename>lm-tools/interpolate-lm.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Computes the optimal mixture (in terms of devel text perplexity) of language
# models, and creates an interpolated language model using SRILM.
import argparse
import sys
import tempfile
import subprocess
import re
fro... | <filename>lm-tools/interpolate-lm.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Computes the optimal mixture (in terms of devel text perplexity) of language
# models, and creates an interpolated language model using SRILM.
import argparse
import sys
import tempfile
import subprocess
import re
fro... | en | 0.744506 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Computes the optimal mixture (in terms of devel text perplexity) of language # models, and creates an interpolated language model using SRILM. | 2.606217 | 3 |
vte/generate.py | textshell/flatpak-terminal-zoo | 0 | 6622676 | <reponame>textshell/flatpak-terminal-zoo
#! /usr/bin/env python3
from string import Template
VTE_TEMPLATE = Template(r"""
{
"app-id": "de.uchuujin.fp.termzoo.vte${vte_version_b}",
"runtime": "org.gnome.Platform",
"runtime-version": "${vte_runtime}",
"sdk": "org.gnome.Sdk",
"command": "vte${vte_api... | #! /usr/bin/env python3
from string import Template
VTE_TEMPLATE = Template(r"""
{
"app-id": "de.uchuujin.fp.termzoo.vte${vte_version_b}",
"runtime": "org.gnome.Platform",
"runtime-version": "${vte_runtime}",
"sdk": "org.gnome.Sdk",
"command": "vte${vte_api}",
"finish-args": ["--socket=x11", "... | en | 0.303026 | #! /usr/bin/env python3 { "app-id": "de.uchuujin.fp.termzoo.vte${vte_version_b}", "runtime": "org.gnome.Platform", "runtime-version": "${vte_runtime}", "sdk": "org.gnome.Sdk", "command": "vte${vte_api}", "finish-args": ["--socket=x11", "--device=dri", "--talk-name=org.freedesktop.Flatpak"], ... | 2.03468 | 2 |
src/oci/cloud_guard/models/security_zone_target_details.py | pabs3/oci-python-sdk | 0 | 6622677 | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | en | 0.695344 | # coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 2.112314 | 2 |
tasks.py | guilatrova/school-api-load-test | 0 | 6622678 | import time
from locust import TaskSet, task
from factories import create_questions
class OnStartSetupDataMixin:
def post_json_get_id(self, url, payload):
response = self.client.post(url, json=payload)
time.sleep(0.1) #Required to avoid connection error
return response.json()['id']
def... | import time
from locust import TaskSet, task
from factories import create_questions
class OnStartSetupDataMixin:
def post_json_get_id(self, url, payload):
response = self.client.post(url, json=payload)
time.sleep(0.1) #Required to avoid connection error
return response.json()['id']
def... | en | 0.794519 | #Required to avoid connection error | 2.511381 | 3 |
leetcode_python/Breadth-First-Search/bus-routes.py | yennanliu/Python_basics | 0 | 6622679 | """
815. Bus Routes
Hard
You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever.
For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever.
You will start at the bus stop sou... | """
815. Bus Routes
Hard
You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever.
For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever.
You will start at the bus stop sou... | en | 0.866819 | 815. Bus Routes Hard You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever. For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever. You will start at the bus stop source (... | 3.794514 | 4 |
smartcliapp/informer.py | smartlegionlab/smartcliapp | 2 | 6622680 | # -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2021, <NAME>
# All rights reserved.
# --------------------------------------------------------
from smartprinter.printers import Print... | # -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2021, <NAME>
# All rights reserved.
# --------------------------------------------------------
from smartprinter.printers import Print... | en | 0.668829 | # -*- coding: utf-8 -*- # -------------------------------------------------------- # Licensed under the terms of the BSD 3-Clause License # (see LICENSE for details). # Copyright © 2018-2021, <NAME> # All rights reserved. # -------------------------------------------------------- Informer - Override the attributes ... | 2.958591 | 3 |
ObitSystem/ObitTalk/python/AIPS.py | sarrvesh/Obit | 5 | 6622681 | # Copyright (C) 2005 Joint Institute for VLBI in Europe
# Copyright (C) 2007,2019 Associated Universities, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,... | # Copyright (C) 2005 Joint Institute for VLBI in Europe
# Copyright (C) 2007,2019 Associated Universities, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,... | en | 0.862994 | # Copyright (C) 2005 Joint Institute for VLBI in Europe # Copyright (C) 2007,2019 Associated Universities, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License,... | 2.059915 | 2 |
packages/ipylintotype/src/ipylintotype/diagnosers/pylint_diagnoser.py | deathbeds/lintotype | 18 | 6622682 | <reponame>deathbeds/lintotype
import contextlib
import io
import re
import typing as typ
from pathlib import Path
from tempfile import TemporaryDirectory
import pylint.lint
import traitlets
from .. import shapes
from .diagnoser import Diagnoser, InteractiveShell, IPythonDiagnoser
_re_pylint = r"^(.):\s*(\d+),\s(\d+)... | import contextlib
import io
import re
import typing as typ
from pathlib import Path
from tempfile import TemporaryDirectory
import pylint.lint
import traitlets
from .. import shapes
from .diagnoser import Diagnoser, InteractiveShell, IPythonDiagnoser
_re_pylint = r"^(.):\s*(\d+),\s(\d+):\s*(.*?)\s*\((.*)\)$"
_help... | en | 0.41608 | #command-line-options" --disable={",".join(rules)} # type: typ.List[shapes.Diagnostic] | 2.162967 | 2 |
tests/testmodels.py | sunshiding/cca_zoo-1 | 1 | 6622683 | <filename>tests/testmodels.py
import itertools
from unittest import TestCase
import numpy as np
import scipy.sparse as sp
from sklearn.utils.validation import check_random_state
from cca_zoo.models import CCA, PLS, CCA_ALS, SCCA, PMD, ElasticCCA, rCCA, KCCA, KTCCA, MCCA, GCCA, TCCA, SCCA_ADMM, \
SpanCCA, SWCCA
... | <filename>tests/testmodels.py
import itertools
from unittest import TestCase
import numpy as np
import scipy.sparse as sp
from sklearn.utils.validation import check_random_state
from cca_zoo.models import CCA, PLS, CCA_ALS, SCCA, PMD, ElasticCCA, rCCA, KCCA, KTCCA, MCCA, GCCA, TCCA, SCCA_ADMM, \
SpanCCA, SWCCA
... | en | 0.883873 | # Tests unregularized CCA methods. The idea is that all of these should give the same result. # Check the score outputs are the right shape # Check the correlations from each unregularized method are the same # Tests unregularized CCA methods. The idea is that all of these should give the same result. # Check the score... | 2.2539 | 2 |
MUSCIMarker/cropobject_view.py | penestia/muscimarker-python3 | 6 | 6622684 | <filename>MUSCIMarker/cropobject_view.py
"""This module implements a class that..."""
from __future__ import division
from __future__ import print_function, unicode_literals
import logging
import os
import uuid
from builtins import str
import scipy.misc
from kivy.app import App
from kivy.core.window import Window
fro... | <filename>MUSCIMarker/cropobject_view.py
"""This module implements a class that..."""
from __future__ import division
from __future__ import print_function, unicode_literals
import logging
import os
import uuid
from builtins import str
import scipy.misc
from kivy.app import App
from kivy.core.window import Window
fro... | en | 0.650098 | This module implements a class that... # Should behave like a ToggleButton. # Important difference from ListItemButton: # # * Colors defined at initialization time, # * Text is empty The view to an individual CropObject. Implements interface for CropObject manipulation. Selection --------- The ``CropO... | 2.613813 | 3 |
test/test_wrapper.py | urish/wrapped_rgb_mixer | 5 | 6622685 | import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles
from rgb_mixer.test.encoder import Encoder
@cocotb.test()
async def test_wrapper(dut):
clock = Clock(dut.wb_clk_i, 10, units="ns")
cocotb.fork(clock.start())
clocks_per_phase = 5
encoder = En... | import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles
from rgb_mixer.test.encoder import Encoder
@cocotb.test()
async def test_wrapper(dut):
clock = Clock(dut.wb_clk_i, 10, units="ns")
cocotb.fork(clock.start())
clocks_per_phase = 5
encoder = En... | en | 0.791003 | # count up with encoder with project inactive # pause # activate project # reset it # count up with encoder while project is active | 2.247041 | 2 |
allsix.py | getmykhan/Data-Visualization-Tool | 0 | 6622686 | def graphplot(dfcol1,dfcol2,path):
plt.subplot(321)
plt.plot(dfcol1,dfcol2) #line chart
plt.title(path)
# plt.show()
plt.subplot(322)
plt.bar(dfcol1,dfcol2) #bar chart
plt.title(path)
plt.subplot(323)
plt.hist(dfcol1,dfcol2) #histogram
p... | def graphplot(dfcol1,dfcol2,path):
plt.subplot(321)
plt.plot(dfcol1,dfcol2) #line chart
plt.title(path)
# plt.show()
plt.subplot(322)
plt.bar(dfcol1,dfcol2) #bar chart
plt.title(path)
plt.subplot(323)
plt.hist(dfcol1,dfcol2) #histogram
p... | en | 0.502737 | #line chart # plt.show() #bar chart #histogram #scatter plot #stack chart | 2.780679 | 3 |
windows-mlps-lrsignal/src/data_management/dataset.py | Amir-Mehrpanah/RRFLab | 0 | 6622687 | <reponame>Amir-Mehrpanah/RRFLab<gh_stars>0
import glob
import logging
import torch
from torch.utils.data import Dataset
import pandas as pd
import numpy as np
import os
class SlidingWindowDataset(Dataset):
"""Sliding Window Dataset [Symbol,NumParWin,WinWidth]."""
def __init__(self, dynamic_config):
s... | import glob
import logging
import torch
from torch.utils.data import Dataset
import pandas as pd
import numpy as np
import os
class SlidingWindowDataset(Dataset):
"""Sliding Window Dataset [Symbol,NumParWin,WinWidth]."""
def __init__(self, dynamic_config):
self.demo = dynamic_config['demo']
s... | en | 0.233422 | Sliding Window Dataset [Symbol,NumParWin,WinWidth]. # self.transform = Config.transform # print('dataset shape:', self.stock_data.shape) # if self.transform: # backward_window = self.transform(backward_window) | 2.691761 | 3 |
exercises/ex20.py | ramachandrajr/lpthw | 0 | 6622688 | <reponame>ramachandrajr/lpthw<filename>exercises/ex20.py
# Import argv to get arguments
from sys import argv
# Unpacking
script, input_file = argv
# A function to print the whole file.
def print_all(f):
print f.read()
# read is used to read the whole file.
# Function with a single argument
def rewind(f):
... | # Import argv to get arguments
from sys import argv
# Unpacking
script, input_file = argv
# A function to print the whole file.
def print_all(f):
print f.read()
# read is used to read the whole file.
# Function with a single argument
def rewind(f):
# Sets pointer to the start of the file.
f.seek(0)
... | en | 0.839338 | # Import argv to get arguments # Unpacking # A function to print the whole file. # read is used to read the whole file. # Function with a single argument # Sets pointer to the start of the file. # RJ # ===== # function that takes two arguments # Prints first argument and then reads a # single line from file. # Open a f... | 4.483949 | 4 |
test/CheckTexinfo.py | sanel/ledger | 3,509 | 6622689 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import re
import os
import argparse
from os.path import *
from subprocess import Popen, PIPE
from CheckOptions import CheckOptions
class CheckTexinfo (CheckOptions):
def __init__(self, args):
CheckOptions.__init__(... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import re
import os
import argparse
from os.path import *
from subprocess import Popen, PIPE
from CheckOptions import CheckOptions
class CheckTexinfo (CheckOptions):
def __init__(self, args):
CheckOptions.__init__(... | en | 0.352855 | #!/usr/bin/env python # -*- coding: utf-8 -*- | 2.624059 | 3 |
habitica/test_habiticaAPIClient.py | mate3241/github-rpg | 22 | 6622690 | <gh_stars>10-100
from unittest import TestCase
from httmock import HTTMock, all_requests, response
from habitica.habitica_api import HabiticaAPIClient
class TestHabiticaAPIClient(TestCase):
def test_get_existing_todo_task(self):
get_task_url_path = '/api/v3/tasks/alias'
@all_requests
de... | from unittest import TestCase
from httmock import HTTMock, all_requests, response
from habitica.habitica_api import HabiticaAPIClient
class TestHabiticaAPIClient(TestCase):
def test_get_existing_todo_task(self):
get_task_url_path = '/api/v3/tasks/alias'
@all_requests
def requests_mock(u... | none | 1 | 2.32572 | 2 | |
2.linked-list/single-linked-list/reverse-even-nodes/reverse_odd_list.py | tienduy-nguyen/coderust | 0 | 6622691 | class ListNode:
def __init__(self, val, next=None):
self.val = val
self.next = next
def reverse_odd(self, head):
dummy1 = odd = ListNode(0)
dummy2 = even = ListNode(0)
while head:
odd.next = head
even.next = head.next
odd = odd.next
even = even.next
... | class ListNode:
def __init__(self, val, next=None):
self.val = val
self.next = next
def reverse_odd(self, head):
dummy1 = odd = ListNode(0)
dummy2 = even = ListNode(0)
while head:
odd.next = head
even.next = head.next
odd = odd.next
even = even.next
... | none | 1 | 3.778013 | 4 | |
lib/decorator.py | ligulfzhou/PyBaseProject | 2 | 6622692 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pdb
import hashlib
from lib import utils
from tornado.options import options
from sqlalchemy.orm import class_mapper
def model2dict(model):
if not model:
return {}
fields = class_mapper(model.__class__).columns.keys()
return dict((col, getattr(m... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pdb
import hashlib
from lib import utils
from tornado.options import options
from sqlalchemy.orm import class_mapper
def model2dict(model):
if not model:
return {}
fields = class_mapper(model.__class__).columns.keys()
return dict((col, getattr(m... | en | 0.138358 | #!/usr/bin/env python # -*- coding: utf-8 -*- manager: 管理 personel / fzr 都有权限 # def forbid_frequent_api_call(seconds=[]): # def decorator(func): # def wrap(*args, **kw): # self = args[0] # sign = self.get_argument('sign', '') # user_id = self.get_argument('user_id', 0... | 2.403484 | 2 |
tests/unittests/test_log_filtering_functions.py | anandagopal6/azure-functions-python-worker | 277 | 6622693 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import typing
from azure_functions_worker import testutils
from azure_functions_worker.testutils import TESTS_ROOT, remove_path
HOST_JSON_TEMPLATE_WITH_LOGLEVEL_INFO = """\
{
"version": "2.0",
"logging": {
"l... | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import typing
from azure_functions_worker import testutils
from azure_functions_worker.testutils import TESTS_ROOT, remove_path
HOST_JSON_TEMPLATE_WITH_LOGLEVEL_INFO = """\
{
"version": "2.0",
"logging": {
"l... | en | 0.745005 | # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. \ { "version": "2.0", "logging": { "logLevel": { "default": "Information" } }, "functionTimeout": "00:05:00" } This class is for testing the logger behavior in Python Worker when ... | 2.285564 | 2 |
src/spiegelib/features/fft.py | spiegel-lib/spiegel | 10 | 6622694 | #!/usr/bin/env python
"""
Fast Fourier Transform (FFT)
"""
import numpy as np
from spiegelib import AudioBuffer
from spiegelib.features.features_base import FeaturesBase
import spiegelib.core.utils as utils
class FFT(FeaturesBase):
"""
Args:
fft_sze (int, optional): Size of FFT to use. If set, will t... | #!/usr/bin/env python
"""
Fast Fourier Transform (FFT)
"""
import numpy as np
from spiegelib import AudioBuffer
from spiegelib.features.features_base import FeaturesBase
import spiegelib.core.utils as utils
class FFT(FeaturesBase):
"""
Args:
fft_sze (int, optional): Size of FFT to use. If set, will t... | en | 0.689745 | #!/usr/bin/env python Fast Fourier Transform (FFT) Args: fft_sze (int, optional): Size of FFT to use. If set, will truncate input if input is smaller than FFT size. If FFT size is larger than input, will zero-pad. Defaults to None, so FFT will be the size of input. output (str, o... | 2.776815 | 3 |
src/file_item.py | ferranferri/exif_classifier | 0 | 6622695 | <reponame>ferranferri/exif_classifier<filename>src/file_item.py
import os
import hashlib
import piexif
import shutil
import logging
class FileItem:
def __init__(self, source_path):
if not os.path.isabs(source_path):
raise ValueError("Path must me absolut!!\n >>" + source_path)
self.sou... | import os
import hashlib
import piexif
import shutil
import logging
class FileItem:
def __init__(self, source_path):
if not os.path.isabs(source_path):
raise ValueError("Path must me absolut!!\n >>" + source_path)
self.source_path = source_path
self.dest_path = ''
self.... | en | 0.888266 | # assume is a directory # get the file name | 2.62428 | 3 |
gpulimit/gpulimit_core/__init__.py | MendelXu/gpu-limit | 5 | 6622696 | <filename>gpulimit/gpulimit_core/__init__.py
from .run_task_core import task_manage
from .socket_utils import send_all, recv_all, send_all_str, recv_all_str | <filename>gpulimit/gpulimit_core/__init__.py
from .run_task_core import task_manage
from .socket_utils import send_all, recv_all, send_all_str, recv_all_str | none | 1 | 1.143604 | 1 | |
tests/shredding.py | 0x00-0x00/shemutils | 3 | 6622697 | #!/bin/bash
import os
from shemutils.shred import Shredder
TARGET_EXT = ".txt"
shredder = Shredder()
for root, dircd, files in os.walk("files/"):
for f in files:
base, ext = os.path.splitext(f)
if ext != TARGET_EXT:
continue
abspath = os.path.join(root, f)
shredder.shre... | #!/bin/bash
import os
from shemutils.shred import Shredder
TARGET_EXT = ".txt"
shredder = Shredder()
for root, dircd, files in os.walk("files/"):
for f in files:
base, ext = os.path.splitext(f)
if ext != TARGET_EXT:
continue
abspath = os.path.join(root, f)
shredder.shre... | en | 0.272457 | #!/bin/bash | 2.682787 | 3 |
labelling.py | elisakathrin/Financial-Time-Series-Forecasting-using-CNN | 1 | 6622698 | Method 1: Using daily adjusted barriers based on daily volatility
# Label creation if only using daily data
import pandas as pd
def get_daily_volatility(df,span0=20):
# simple percentage returns
df0 = df.close.pct_change()
# 20 days, a month EWM's std as boundary
df0=df0.ewm(span=span0).std().to_frame... | Method 1: Using daily adjusted barriers based on daily volatility
# Label creation if only using daily data
import pandas as pd
def get_daily_volatility(df,span0=20):
# simple percentage returns
df0 = df.close.pct_change()
# 20 days, a month EWM's std as boundary
df0=df0.ewm(span=span0).std().to_frame... | en | 0.706922 | # Label creation if only using daily data # simple percentage returns # 20 days, a month EWM's std as boundary #set it to NaNs #set the bottom barrier #set it to NaNs top_barrier: profit taking limit bottom_barrier:stop loss limit daily_volatiliy: average daily volatility based on 20-day moving average barr... | 3.108845 | 3 |
OSPEXinPython/editTime.py | LAbdrakhmanovaOBSPM/OSPEX-Object-Spectral-Executive-in-Python | 0 | 6622699 | <reponame>LAbdrakhmanovaOBSPM/OSPEX-Object-Spectral-Executive-in-Python
from tkinter import *
from astropy.io import fits
import re
import pandas as pd
import plotting
import background_plot
import warnings
import second
import editInterval
class EditTimeWindow():
"""Class to create a Select Time Window"""
bk... | from tkinter import *
from astropy.io import fits
import re
import pandas as pd
import plotting
import background_plot
import warnings
import second
import editInterval
class EditTimeWindow():
"""Class to create a Select Time Window"""
bkgTimeInterv = None
defaultTime = None
def __init__(self, ener... | de | 0.659032 | Class to create a Select Time Window ######################################################################################### ## """ First frame """ ## Current Intervals # str(energyBin) #, command=self.editSelectedInterval) ## ## ##############... | 2.721233 | 3 |
examples/nrf24l01_simple_test.py | nRF24/CircuitPython_nRF24L01 | 3 | 6622700 | <gh_stars>1-10
"""
Simple example of using the RF24 class.
"""
import time
import struct
import board
from digitalio import DigitalInOut
# if running this on a ATSAMD21 M0 based board
# from circuitpython_nrf24l01.rf24_lite import RF24
from circuitpython_nrf24l01.rf24 import RF24
# invalid default values for scoping
... | """
Simple example of using the RF24 class.
"""
import time
import struct
import board
from digitalio import DigitalInOut
# if running this on a ATSAMD21 M0 based board
# from circuitpython_nrf24l01.rf24_lite import RF24
from circuitpython_nrf24l01.rf24 import RF24
# invalid default values for scoping
SPI_BUS, CSN_PI... | en | 0.80548 | Simple example of using the RF24 class. # if running this on a ATSAMD21 M0 based board # from circuitpython_nrf24l01.rf24_lite import RF24 # invalid default values for scoping # on Linux # for a faster interface on linux # use CE0 on default bus (even faster than using any pin) # using pin gpio22 (BCM numbering) # on C... | 2.990403 | 3 |
tfx/tools/cli/pip_utils.py | Anon-Artist/tfx | 1,813 | 6622701 | # Copyright 2020 Google LLC. 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 required by applicable law or a... | # Copyright 2020 Google LLC. 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 required by applicable law or a... | en | 0.855917 | # Copyright 2020 Google LLC. 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 required by applicable law or a... | 2.090432 | 2 |
lmdb/home/views.py | huzaifafaruqui/Movies-Website | 11 | 6622702 | <filename>lmdb/home/views.py
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.core.urlresolvers import reverse
from .models import Movie
from django.con... | <filename>lmdb/home/views.py
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.core.urlresolvers import reverse
from .models import Movie
from django.con... | en | 0.494022 | # Create your views here. # avg_stars = movie.objects.annotate(Avg('rating__stars')) # 'stars':avg_stars # avg_stars = movie.objects.annotate(Avg('rating__stars')) # 'stars':avg_stars | 2.235627 | 2 |
tests/test_clip_version.py | gowithfloat/clippy | 2 | 6622703 | <filename>tests/test_clip_version.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for clip.py
"""
import unittest
from clippy import begin_clippy
__version__ = "0.0.1"
class TestClip(unittest.TestCase):
def test_begin_version(self):
with self.assertRaises(SystemExit) as err:
be... | <filename>tests/test_clip_version.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for clip.py
"""
import unittest
from clippy import begin_clippy
__version__ = "0.0.1"
class TestClip(unittest.TestCase):
def test_begin_version(self):
with self.assertRaises(SystemExit) as err:
be... | en | 0.499875 | #!/usr/bin/env python # -*- coding: utf-8 -*- Tests for clip.py | 2.362566 | 2 |
gdal/swig/python/scripts/tests/gdal2tiles/test_reproject_dataset.py | jpapadakis/gdal | 18 | 6622704 | from unittest import mock, TestCase
from osgeo import gdal, osr
import gdal2tiles
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
class ReprojectDatasetTest(TestCase):
def setUp(self):
self.DEFAULT_OPT... | from unittest import mock, TestCase
from osgeo import gdal, osr
import gdal2tiles
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
class ReprojectDatasetTest(TestCase):
def setUp(self):
self.DEFAULT_OPT... | none | 1 | 2.319479 | 2 | |
micropsi_server/tests/test_json_api.py | Doik/micropsi2 | 0 | 6622705 |
import pytest
import json
import re
def assert_success(response):
assert response.json_body['status'] == 'success'
assert 'data' in response.json_body
def assert_failure(response):
assert response.json_body['status'] == 'error'
assert 'data' in response.json_body
def test_generate_uid(app):
r... |
import pytest
import json
import re
def assert_success(response):
assert response.json_body['status'] == 'success'
assert 'data' in response.json_body
def assert_failure(response):
assert response.json_body['status'] == 'error'
assert 'data' in response.json_body
def test_generate_uid(app):
r... | en | 0.373152 | # create a native module: nodetype_definition = { "name": "Testnode", "slottypes": ["gen", "foo", "bar"], "nodefunction_name": "testnodefunc", "gatetypes": ["gen", "foo", "bar"], "symbol": "t"} def testnodefunc(netapi, node=None, **prams): return 17 nodet... | 2.059968 | 2 |
exercise/migrations/0019_auto_20191107_1613.py | Arpit8081/Phishtray_Edited_Version | 2 | 6622706 | # Generated by Django 2.2.5 on 2019-11-07 16:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exercise', '0018_auto_20191104_1647'),
]
operations = [
migrations.RemoveField(
model_name='exerciseemail',
name='from_profi... | # Generated by Django 2.2.5 on 2019-11-07 16:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exercise', '0018_auto_20191104_1647'),
]
operations = [
migrations.RemoveField(
model_name='exerciseemail',
name='from_profi... | en | 0.793059 | # Generated by Django 2.2.5 on 2019-11-07 16:13 | 1.360637 | 1 |
scripts/subpro/parent.py | MadhuNimmo/jalangi2 | 0 | 6622707 | import subprocess
p = subprocess.run(["python", "/home/anon/jalangi2/scripts/subpro/child.py"], capture_output=True)
print(p) | import subprocess
p = subprocess.run(["python", "/home/anon/jalangi2/scripts/subpro/child.py"], capture_output=True)
print(p) | none | 1 | 1.974646 | 2 | |
main.py | phtaedrus/salad | 0 | 6622708 | import csv
import pandas as pd
import numpy as np
import sqlalchemy
from sqlalchemy import Column, Integer, String, schema
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import Date, Text, Enum
pd.set_option('display.max_rows', 500)
FILE = "challenge_... | import csv
import pandas as pd
import numpy as np
import sqlalchemy
from sqlalchemy import Column, Integer, String, schema
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import Date, Text, Enum
pd.set_option('display.max_rows', 500)
FILE = "challenge_... | en | 0.61698 | # sqlAlchemy declarative config # TODO format all of the columns # df['Passed2'] = df['status'].map(lambda x: x.is_integer()) # TODO with a better rested brain check the logic here, implement and submit. # TODO create logic to check birthdate against when it was created. Loads modified pd.Dataframe() objects to sql dat... | 3.541858 | 4 |
Test/getSystemVisitCode.py | sulantha2006/Processing_Pipeline | 1 | 6622709 | <reponame>sulantha2006/Processing_Pipeline<filename>Test/getSystemVisitCode.py
__author__ = 'sulantha'
import datetime
from Utils.DbUtils import DbUtils
csvFile = '/data/data03/sulantha/Downloads/av45_list.csv'
MatchDBClient = DbUtils(database='Study_Data.ADNI')
DBClient = DbUtils()
with open(csvFile, 'r') as csv:
... | __author__ = 'sulantha'
import datetime
from Utils.DbUtils import DbUtils
csvFile = '/data/data03/sulantha/Downloads/av45_list.csv'
MatchDBClient = DbUtils(database='Study_Data.ADNI')
DBClient = DbUtils()
with open(csvFile, 'r') as csv:
next(csv)
for line in csv:
row = line.split(',')
rid = row[... | en | 0.212838 | #dateT = datetime.datetime.strptime(date, '%Y-%m-%d') #print(checkDBSQL) ########################## Not in DB - {0} - {1}'.format(rid, date)) | 2.725999 | 3 |
backend/tests/unit/controller/auth/test_login_controller.py | willrp/willbuyer | 4 | 6622710 | import pytest
import re
import responses
import json
from unittest.mock import MagicMock
from flask_dance.consumer.storage import MemoryStorage
from flask_login import current_user
from oauthlib.oauth2 import InvalidGrantError, MissingCodeError, MismatchingStateError
from sqlalchemy.exc import DatabaseError
from backe... | import pytest
import re
import responses
import json
from unittest.mock import MagicMock
from flask_dance.consumer.storage import MemoryStorage
from flask_login import current_user
from oauthlib.oauth2 import InvalidGrantError, MissingCodeError, MismatchingStateError
from sqlalchemy.exc import DatabaseError
from backe... | none | 1 | 2.368243 | 2 | |
ChordalPy/Chord.py | P-bibs/PyChord | 2 | 6622711 | import functools
from ChordalPy import Tables
class Chord:
"""A class representing a chord.
Attributes:
root (string): The root note of the chord.
intervals (list[(int, int), ...]): The imaginary part of complex number.
bass (string): The bass note of the chord.
"""
def __ini... | import functools
from ChordalPy import Tables
class Chord:
"""A class representing a chord.
Attributes:
root (string): The root note of the chord.
intervals (list[(int, int), ...]): The imaginary part of complex number.
bass (string): The bass note of the chord.
"""
def __ini... | en | 0.732239 | A class representing a chord. Attributes: root (string): The root note of the chord. intervals (list[(int, int), ...]): The imaginary part of complex number. bass (string): The bass note of the chord. Construct a chord given a root, intervals, and a bass. # PitchName object # tuple of Inter... | 3.608048 | 4 |
src/main.py | megan-levy/python-life | 1 | 6622712 | <reponame>megan-levy/python-life
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from array import *
ALIVE = 1
DEAD = 0
OFFSETS = [-1, 0, 1]
def makeUniverse(... | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from array import *
ALIVE = 1
DEAD = 0
OFFSETS = [-1, 0, 1]
def makeUniverse(rows, columns):
return [[0] ... | en | 0.720151 | # This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. # 1100 0000 # 0X00 => 0000 # 0000 0000 # 0011 0000 # Press the green button in the gutter to run the script. # u... | 3.22633 | 3 |
Anagram_Sort.py | sidhu177/pythonprog | 2 | 6622713 | def anagram(lst):
ana = []
tot = []
dict_sort = {'word':[],'lst_sort':[]}
for i in lst:
val = sorted(i)
val = "".join(val)
dict_sort['word'].append(i)
dict_sort['lst_sort'].append(val)
words = list(dict_sort.values())[0]
lst_sorts = list(dict_sort... | def anagram(lst):
ana = []
tot = []
dict_sort = {'word':[],'lst_sort':[]}
for i in lst:
val = sorted(i)
val = "".join(val)
dict_sort['word'].append(i)
dict_sort['lst_sort'].append(val)
words = list(dict_sort.values())[0]
lst_sorts = list(dict_sort... | none | 1 | 3.688244 | 4 | |
IdioMaticPython/dictionaries.py | shaunryan/PythonReference | 0 | 6622714 | <reponame>shaunryan/PythonReference
# https://www.youtube.com/watch?v=OSGv2VnC0go
from pprint import pprint
d = {
'matthew': 'blue',
'rachel': 'green',
'raymond': 'red'
}
# method 1
for k in d:
print(k)
# method 2 - when mutating the dictionary
delete = [k for k in d if k.startswith("r")]
# loop... | # https://www.youtube.com/watch?v=OSGv2VnC0go
from pprint import pprint
d = {
'matthew': 'blue',
'rachel': 'green',
'raymond': 'red'
}
# method 1
for k in d:
print(k)
# method 2 - when mutating the dictionary
delete = [k for k in d if k.startswith("r")]
# looping keys and values
for k, v in enum... | en | 0.629021 | # https://www.youtube.com/watch?v=OSGv2VnC0go # method 1 # method 2 - when mutating the dictionary # looping keys and values # construct dictionary using lists # counting with dictionaries # better # https://realpython.com/python-defaultdict/ # default the dict using int(0) # group with dictionaries # better # if no ke... | 3.454495 | 3 |
retopoflow/rfwidget.py | senjacob/retopoflow | 0 | 6622715 | '''
Copyright (C) 2021 CG Cookie
http://cgcookie.com
<EMAIL>
Created by <NAME>, <NAME>, and <NAME>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... | '''
Copyright (C) 2021 CG Cookie
http://cgcookie.com
<EMAIL>
Created by <NAME>, <NAME>, and <NAME>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... | en | 0.877714 | Copyright (C) 2021 CG Cookie http://cgcookie.com <EMAIL> Created by <NAME>, <NAME>, and <NAME> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at... | 1.703797 | 2 |
PythonExecicios/ex004.py | lucasohara98/Python_CursoemVideo | 0 | 6622716 | n = input('digite algo: ') # função input sempre retorna uma variavel do tipo str
print('o tipo primitivo desse valor é {}'.format(type(n)))
print('Só tem espaço? {}'.format(n.isspace()))
print('É um número? {}'.format(n.isnumeric()))
print('É um alfábetico? {}'.format(n.isalpha()))
print('É alfanumérico? {}'.form... | n = input('digite algo: ') # função input sempre retorna uma variavel do tipo str
print('o tipo primitivo desse valor é {}'.format(type(n)))
print('Só tem espaço? {}'.format(n.isspace()))
print('É um número? {}'.format(n.isnumeric()))
print('É um alfábetico? {}'.format(n.isalpha()))
print('É alfanumérico? {}'.form... | pt | 0.993738 | # função input sempre retorna uma variavel do tipo str | 4.138374 | 4 |
tests/test_qqplot.py | piccolbo/altair_recipes | 89 | 6622717 | <reponame>piccolbo/altair_recipes<gh_stars>10-100
import altair_recipes as ar
from altair_recipes.common import viz_reg_test
from altair_recipes.display_pweave import show_test
import numpy as np
import pandas as pd
#' <h2>Qqplot</h2>
@viz_reg_test
def test_qqplot():
df = pd.DataFrame(
{
"T... | import altair_recipes as ar
from altair_recipes.common import viz_reg_test
from altair_recipes.display_pweave import show_test
import numpy as np
import pandas as pd
#' <h2>Qqplot</h2>
@viz_reg_test
def test_qqplot():
df = pd.DataFrame(
{
"Trial A": np.random.normal(0, 0.8, 1000),
... | th | 0.148764 | #' <h2>Qqplot</h2> | 2.385839 | 2 |
Protheus_WebApp/Modules/SIGATEC/TECA640TESTCASE.py | 98llm/tir-script-samples | 17 | 6622718 | from tir import Webapp
import unittest
class TECA640(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup("SIGATEC","11/12/2020","T1","D MG 01","28")
inst.oHelper.Program("TECA640")
def test_TECA640_001(self):
self.oHelper.SetValue("Cliente de ?","")
self.oH... | from tir import Webapp
import unittest
class TECA640(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup("SIGATEC","11/12/2020","T1","D MG 01","28")
inst.oHelper.Program("TECA640")
def test_TECA640_001(self):
self.oHelper.SetValue("Cliente de ?","")
self.oH... | none | 1 | 2.702161 | 3 | |
hackerrank/coin_change.py | anouard24/problem-solving | 0 | 6622719 | <reponame>anouard24/problem-solving
# https://www.hackerrank.com/challenges/coin-change/problem
def getWays(n, c):
c.sort()
coins = len(c) + 1
mem = [0] * coins
for i in range(coins):
mem[i] = [0] * (n + 1)
for i in range(1, coins):
for j in range(n + 1):
if j < c[i - ... | # https://www.hackerrank.com/challenges/coin-change/problem
def getWays(n, c):
c.sort()
coins = len(c) + 1
mem = [0] * coins
for i in range(coins):
mem[i] = [0] * (n + 1)
for i in range(1, coins):
for j in range(n + 1):
if j < c[i - 1]:
mem[i][j] = mem[... | en | 0.739607 | # https://www.hackerrank.com/challenges/coin-change/problem # Print the number of ways of making change for 'n' units # using coins having the values given by 'c' | 3.457684 | 3 |
autoscout24/autoscout24/properties/properties.py | vkresch/autoscout24-crawler | 3 | 6622720 | <filename>autoscout24/autoscout24/properties/properties.py
from enum import Enum
class Make(Enum):
ALL = ""
BMW = "/bmw"
AUDI = "/audi"
FORD = "/ford"
MERCEDES_BENZ = "/mercedes-benz"
OPEL = "/opel"
VOLKSWAGEN = "/volkswagen"
RENAULT = "/renault"
TOYOTA = "/toyota"
PEUGEOT = "/p... | <filename>autoscout24/autoscout24/properties/properties.py
from enum import Enum
class Make(Enum):
ALL = ""
BMW = "/bmw"
AUDI = "/audi"
FORD = "/ford"
MERCEDES_BENZ = "/mercedes-benz"
OPEL = "/opel"
VOLKSWAGEN = "/volkswagen"
RENAULT = "/renault"
TOYOTA = "/toyota"
PEUGEOT = "/p... | en | 0.469831 | # NINEFF = "/9ff" # ABARTH = "/abarth" # AC = "/ac" # ACM = "/acm" # ACURA = "/acura" # AIXAM = "/aixam" # ALFA_ROMEO = "/alfa-romeo" # ALPINA = "/alpina" # ALPINE = "/alpine" # AMPHICAR = "/amphicar" # ARIEL_MOTOR = "/ariel-motor" # ARTEGA = "/artega" # ASPID = "/aspid" # ASTON_MARTIN = "/aston-martin" # AUSTIN = "/au... | 2.570418 | 3 |
src/clients/aws_athena_async_client.py | jezd-axyl/platsec-aws-scanner | 0 | 6622721 | from logging import getLogger
from string import Template
from time import sleep
from typing import Any, Dict, List, Type
from botocore.client import BaseClient
from botocore.exceptions import BotoCoreError, ClientError
from src.data import aws_scanner_exceptions as exceptions
from src.clients import aws_athena_syste... | from logging import getLogger
from string import Template
from time import sleep
from typing import Any, Dict, List, Type
from botocore.client import BaseClient
from botocore.exceptions import BotoCoreError, ClientError
from src.data import aws_scanner_exceptions as exceptions
from src.clients import aws_athena_syste... | none | 1 | 2.035024 | 2 | |
tgtypes/models/shipping_address.py | autogram/tgtypes | 0 | 6622722 | <gh_stars>0
from __future__ import annotations
from ._base import TelegramObject
class ShippingAddress(TelegramObject):
"""
This object represents a shipping address.
Source: https://core.telegram.org/bots/api#shippingaddress
"""
country_code: str
"""ISO 3166-1 alpha-2 country code"""
s... | from __future__ import annotations
from ._base import TelegramObject
class ShippingAddress(TelegramObject):
"""
This object represents a shipping address.
Source: https://core.telegram.org/bots/api#shippingaddress
"""
country_code: str
"""ISO 3166-1 alpha-2 country code"""
state: str
... | en | 0.843465 | This object represents a shipping address. Source: https://core.telegram.org/bots/api#shippingaddress ISO 3166-1 alpha-2 country code State, if applicable City First line for the address Second line for the address Address post code | 2.926208 | 3 |
addons/io_sketchfab_plugin/blender/com/gltf2_blender_material_helpers.py | gorenje/blender-plugin | 2 | 6622723 | <filename>addons/io_sketchfab_plugin/blender/com/gltf2_blender_material_helpers.py
"""
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version... | <filename>addons/io_sketchfab_plugin/blender/com/gltf2_blender_material_helpers.py
"""
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version... | en | 0.83216 | * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distr... | 1.847404 | 2 |
utils/ASSO/utils.py | mrazekv/BLASYS | 11 | 6622724 | import numpy as np
def get_matrix(file_path):
with open(file_path) as f:
lines = f.readlines()
mat = [list(i.strip().replace(' ', '')) for i in lines]
return np.array(mat, dtype=np.uint8)
def write_matrix(mat, file_path):
with open(file_path, 'w') as f:
for row in mat:
fo... | import numpy as np
def get_matrix(file_path):
with open(file_path) as f:
lines = f.readlines()
mat = [list(i.strip().replace(' ', '')) for i in lines]
return np.array(mat, dtype=np.uint8)
def write_matrix(mat, file_path):
with open(file_path, 'w') as f:
for row in mat:
fo... | en | 0.827401 | # Compute association matrix # Mark whether an entry is already covered # Coefficient matrix for bonux or penalty # If in binary mode, make coef exponential # Candidate pair of basis and solver # Compute score for each row # Compute solver # Compute accumulate point # Stack matrix B and S # Update covered matrix | 2.582603 | 3 |
Codewars/5kyu/moveZero.py | Ry4nW/python-wars | 1 | 6622725 | <reponame>Ry4nW/python-wars
def move_zeros(array):
numArr = []
zeroCount = 0
for i in array:
if i != 0:
numArr.append(i)
else:
zeroCount += 1
for i in range(zeroCount):
numArr.append(0)
return numArr
print(move_zero... | def move_zeros(array):
numArr = []
zeroCount = 0
for i in array:
if i != 0:
numArr.append(i)
else:
zeroCount += 1
for i in range(zeroCount):
numArr.append(0)
return numArr
print(move_zeros([1, 0]))
# One-liner:
def... | en | 0.582608 | # One-liner: | 3.767092 | 4 |
mi9_dj/handlers/websocket_handler.py | nhardy/mi9-dj | 0 | 6622726 | import tornado.websocket, tornado.gen
import json
import asyncio
from ..app import App
class WebSocketHandler(tornado.websocket.WebSocketHandler):
_APP = App()
_sockets = set()
def _write_all(self, message):
for ws in self._sockets:
ws.write_message(message)
def _send_state(self):
state = {'cm... | import tornado.websocket, tornado.gen
import json
import asyncio
from ..app import App
class WebSocketHandler(tornado.websocket.WebSocketHandler):
_APP = App()
_sockets = set()
def _write_all(self, message):
for ws in self._sockets:
ws.write_message(message)
def _send_state(self):
state = {'cm... | en | 0.971809 | # TODO: Send message to sender that video was added successfully | 2.485285 | 2 |
ibis/impala/compiler.py | nubank/ibis | 3 | 6622727 | # Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | en | 0.808955 | # Copyright 2014 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so... | 1.800585 | 2 |
ROAR/perception_module/depth_to_pointcloud_detector.py | listar2000/ROAR | 0 | 6622728 | <gh_stars>0
from ROAR.agent_module.agent import Agent
from ROAR.perception_module.detector import Detector
import numpy as np
from typing import Optional
import time
from ROAR.utilities_module.utilities import img_to_world
import cv2
from numpy.matlib import repmat
class DepthToPointCloudDetector(Detector):
def __... | from ROAR.agent_module.agent import Agent
from ROAR.perception_module.detector import Detector
import numpy as np
from typing import Optional
import time
from ROAR.utilities_module.utilities import img_to_world
import cv2
from numpy.matlib import repmat
class DepthToPointCloudDetector(Detector):
def __init__(self,... | en | 0.3588 | :return: 3 x N array of point cloud # it will just return all coordinate pairs # return p3d.T | 2.346402 | 2 |
tools/imgrephaseDC.py | fragrussu/MRItools | 2 | 6622729 | # Code released under BSD Two-Clause license
#
# Copyright (c) 2020 University College London.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the... | # Code released under BSD Two-Clause license
#
# Copyright (c) 2020 University College London.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the... | en | 0.785732 | # Code released under BSD Two-Clause license # # Copyright (c) 2020 University College London. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the a... | 1.223334 | 1 |
reward/runner/base_runner.py | lgvaz/torchrl | 5 | 6622730 | <filename>reward/runner/base_runner.py
import reward.utils as U
import numpy as np
from abc import ABC, abstractmethod
from tqdm.autonotebook import tqdm
from boltons.cacheutils import cachedproperty
class BaseRunner(ABC):
def __init__(self, env, ep_maxlen=None):
self.env = env
self.ep_maxlen = ep... | <filename>reward/runner/base_runner.py
import reward.utils as U
import numpy as np
from abc import ABC, abstractmethod
from tqdm.autonotebook import tqdm
from boltons.cacheutils import cachedproperty
class BaseRunner(ABC):
def __init__(self, env, ep_maxlen=None):
self.env = env
self.ep_maxlen = ep... | none | 1 | 2.427478 | 2 | |
2020/1B/1.py | AmauryLiet/CodeJam | 0 | 6622731 | N = int(input())
directions = {
N: 'N'
}
for case_id in range(1, N + 1):
x, y = map(int, input().split())
moves = ""
while x != 0 or y != 0:
# if len(moves) > 0:
# print('Did', moves[-1])
# print("now at", x, y)
if x % 2 == y % 2:
break
elif x % ... | N = int(input())
directions = {
N: 'N'
}
for case_id in range(1, N + 1):
x, y = map(int, input().split())
moves = ""
while x != 0 or y != 0:
# if len(moves) > 0:
# print('Did', moves[-1])
# print("now at", x, y)
if x % 2 == y % 2:
break
elif x % ... | en | 0.322147 | # if len(moves) > 0: # print('Did', moves[-1]) # print("now at", x, y) # the move to do is horizontal (W-E) # the move to do is vertical (N-S) # false # true #{}: {}'.format(case_id, moves)) #{}: {}'.format(case_id, 'IMPOSSIBLE')) | 3.399727 | 3 |
world challenges 2/df68.py | T-Terra/Exercises-of-Python | 0 | 6622732 | from random import randint
v = 0
print('=' * 30)
print('Vamos jogar PAR OU ÍMPAR...')
print('=' * 30)
while True:
jogador = int(input('Digite um valor: '))
pc = randint(0, 11)
total = jogador + pc
tipo = ' '
while tipo not in 'PI':
tipo = str(input('Par ou Ímpar? [P/I] ')).strip().upper()[0]... | from random import randint
v = 0
print('=' * 30)
print('Vamos jogar PAR OU ÍMPAR...')
print('=' * 30)
while True:
jogador = int(input('Digite um valor: '))
pc = randint(0, 11)
total = jogador + pc
tipo = ' '
while tipo not in 'PI':
tipo = str(input('Par ou Ímpar? [P/I] ')).strip().upper()[0]... | none | 1 | 3.601382 | 4 | |
__init__.py | diehlpk/blender-vtk-plugin | 9 | 6622733 | <gh_stars>1-10
"""
Blender plugin to import vtk unstrucutred grids
author:diehlpk
date: 13.10.2014
"""
bl_info = {"name": "VTK-Importer",
"author": "diehlpk",
"blender": (2, 6, 9),
"version": (0, 0, 1),
"location": "File > Import-Export",
"description": "Import VTK unstructured ... | """
Blender plugin to import vtk unstrucutred grids
author:diehlpk
date: 13.10.2014
"""
bl_info = {"name": "VTK-Importer",
"author": "diehlpk",
"blender": (2, 6, 9),
"version": (0, 0, 1),
"location": "File > Import-Export",
"description": "Import VTK unstructured grid",
... | en | 0.429679 | Blender plugin to import vtk unstrucutred grids author:diehlpk date: 13.10.2014 # Imports for readinf vtk # Import blender addon api Adds a primitive uV sphere to the blender engine @param x_pos X coordinate of the center of the sphere @param y_pos Y coordinate of the center of the sphre @param z_pos Z Coor... | 2.067172 | 2 |
proposal/utils.py | coagulant/pyvideo.ru | 9 | 6622734 | <gh_stars>1-10
# coding: utf-8
import pathlib
def force_path(path):
"""
Return a pathlib.Path instance.
:param path: An object representing a file path ('/tmp/foo', Path(/tmp/foo), etc)
"""
return path if isinstance(path, pathlib.Path) else pathlib.Path(path)
| # coding: utf-8
import pathlib
def force_path(path):
"""
Return a pathlib.Path instance.
:param path: An object representing a file path ('/tmp/foo', Path(/tmp/foo), etc)
"""
return path if isinstance(path, pathlib.Path) else pathlib.Path(path) | en | 0.659447 | # coding: utf-8 Return a pathlib.Path instance. :param path: An object representing a file path ('/tmp/foo', Path(/tmp/foo), etc) | 2.708757 | 3 |
tests/unit/test_list_of_lists.py | csurfer/ezread | 3 | 6622735 | <reponame>csurfer/ezread
import pytest
from ezread import EzReader
from json.decoder import JSONDecodeError
@pytest.mark.parametrize(
"template, expected_rows",
[
("""[0, 1, 2]""", [[1, 2, 3], [2, 4, 6], [3, 6, 9]]),
("""[0, 9]""", [[1, 10], [2, 20], [3, 30]]),
],
)
def test_read(list_of_l... | import pytest
from ezread import EzReader
from json.decoder import JSONDecodeError
@pytest.mark.parametrize(
"template, expected_rows",
[
("""[0, 1, 2]""", [[1, 2, 3], [2, 4, 6], [3, 6, 9]]),
("""[0, 9]""", [[1, 10], [2, 20], [3, 30]]),
],
)
def test_read(list_of_lists_json, template, expe... | en | 0.60899 | [0, 1, 2] [0, 9] [0, 1, 20] # 20 being the missing index. [0, 11] # 11 being the missing index. [0, 1, 20] [0, 11] | 2.522519 | 3 |
fastface/dataset/__init__.py | mdornseif/fastface | 72 | 6622736 | from .base import BaseDataset
from .fddb import FDDBDataset
from .widerface import WiderFaceDataset
__all__ = [
"BaseDataset",
"FDDBDataset",
"WiderFaceDataset",
]
| from .base import BaseDataset
from .fddb import FDDBDataset
from .widerface import WiderFaceDataset
__all__ = [
"BaseDataset",
"FDDBDataset",
"WiderFaceDataset",
]
| none | 1 | 1.074352 | 1 | |
RaspPi Setup/setup.py | felmoreno1726/quitIT | 2 | 6622737 | <gh_stars>1-10
import subprocess
import time
#bashCommand1 = 'raspistill -o test.jpeg'
bashCommand2 = 'bash setup2.sh'
bashCommand3 = 'bash setup.sh'
bashCommand4 = 'rm out.txt'
bashCommand5 = 'sleep 10m'
bashCommand6 = 'bash setup3.sh'
for i in range(30):
#process1 = subprocess.Popen(bashCommand1.split(), stdout=s... | import subprocess
import time
#bashCommand1 = 'raspistill -o test.jpeg'
bashCommand2 = 'bash setup2.sh'
bashCommand3 = 'bash setup.sh'
bashCommand4 = 'rm out.txt'
bashCommand5 = 'sleep 10m'
bashCommand6 = 'bash setup3.sh'
for i in range(30):
#process1 = subprocess.Popen(bashCommand1.split(), stdout=subprocess.PIPE)... | en | 0.247009 | #bashCommand1 = 'raspistill -o test.jpeg' #process1 = subprocess.Popen(bashCommand1.split(), stdout=subprocess.PIPE) #output1, error1 = process1.communicate() | 2.335463 | 2 |
test/bolt_src/data_preparation.py | Jitesh17/classification | 1 | 6622738 |
# In[]:
import pyjeasy.file_utils as f
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
from sys import exit as x
import torch
import torch.nn as nn
import cv2
import matplotlib.pyplot as plt
import torchvision
from torch.utils.data import Dataset, ... |
# In[]:
import pyjeasy.file_utils as f
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
from sys import exit as x
import torch
import torch.nn as nn
import cv2
import matplotlib.pyplot as plt
import torchvision
from torch.utils.data import Dataset, ... | en | 0.404859 | # In[]: # linear algebra # data processing, CSV file I/O (e.g. pd.read_csv) # get_ipython().run_line_magic('matplotlib', 'inline') # In[]: # dataset_path = "/home/jitesh/3d/data/UE_training_results/bolt2/bolt_cropped" # b_type_list = [dir for dir in os.listdir(dataset_path) if dir not in DATA_TYPES] # print(b_type_list... | 2.193609 | 2 |
build/lib/affiliations/templates/utils.py | salimm/django-affiliations | 3 | 6622739 | <gh_stars>1-10
from django.core.mail import send_mail
def createEmailBody(request,aff):
tmp = """Dear """+request.user.get_full_name()+"""
Your confirmation code to confirm your affiliation at """ +aff.org+""" is:
"""+aff.token+"""
Use this code to confirm your affiliation at
http://pittreview/affiliaiton... | from django.core.mail import send_mail
def createEmailBody(request,aff):
tmp = """Dear """+request.user.get_full_name()+"""
Your confirmation code to confirm your affiliation at """ +aff.org+""" is:
"""+aff.token+"""
Use this code to confirm your affiliation at
http://pittreview/affiliaitons
Sincerely,... | en | 0.541823 | Dear Your confirmation code to confirm your affiliation at is: Use this code to confirm your affiliation at http://pittreview/affiliaitons Sincerely, Admin Dear <br/> Your confirmation code to confirm your affiliation at <b> </b> is: <br/> <b> </b><br/> <br/> Use this code to confirm your affiliation ... | 2.638166 | 3 |
pepys_import/core/validators/enhanced_validator.py | debrief/pepys-import | 4 | 6622740 | from pepys_import.core.formats import unit_registry
from pepys_import.utils.unit_utils import (
acceptable_bearing_error,
bearing_between_two_points,
distance_between_two_points_haversine,
)
class EnhancedValidator:
"""Enhanced validator serve to verify the lat/long, in addition to the course/speed/he... | from pepys_import.core.formats import unit_registry
from pepys_import.utils.unit_utils import (
acceptable_bearing_error,
bearing_between_two_points,
distance_between_two_points_haversine,
)
class EnhancedValidator:
"""Enhanced validator serve to verify the lat/long, in addition to the course/speed/he... | en | 0.847283 | Enhanced validator serve to verify the lat/long, in addition to the course/speed/heading # Doesn't need a try-catch as time is a compulsory field, created # when a state is initialised # Doesn't need a try-catch as time is a compulsory field, created # when a state is initialised # Only calculate bearing from the locat... | 2.99622 | 3 |
benchmarks/bench_speed_faiss.py | luccaportes/DESlib | 310 | 6622741 | import gzip
import os
import shutil
import time
import urllib.request
import numpy as np
import pandas as pd
from sklearn.ensemble import BaggingClassifier
from sklearn.model_selection import train_test_split
from deslib.des.knora_e import KNORAE
def run_knorae(pool_classifiers, X_DSEL, y_DSEL, X_test, y_test, knn_... | import gzip
import os
import shutil
import time
import urllib.request
import numpy as np
import pandas as pd
from sklearn.ensemble import BaggingClassifier
from sklearn.model_selection import train_test_split
from deslib.des.knora_e import KNORAE
def run_knorae(pool_classifiers, X_DSEL, y_DSEL, X_test, y_test, knn_... | none | 1 | 2.713564 | 3 | |
op_bridge/__init__.py | xichennn/op_bridge | 3 | 6622742 | from __future__ absolute import
import sys
__future_module__ = True
if sys.version_info[0] < 3:
from Queue import *
else:
raise ImportError('This package shoud not be accessible on Python 3.')
| from __future__ absolute import
import sys
__future_module__ = True
if sys.version_info[0] < 3:
from Queue import *
else:
raise ImportError('This package shoud not be accessible on Python 3.')
| none | 1 | 1.644926 | 2 | |
dataset/regular.py | raminnakhli/Patch-to-Cell | 1 | 6622743 | import os
import numpy as np
from PIL import Image
class Regular:
def __init__(self):
self.input_image_dir_name = "Images"
self.input_label_dir_name = "Labels"
self.input_ihc_dir_name = "IHC"
self.skip_labels = None
self.labeling_type = 'ihc'
self.first_valid_inst... | import os
import numpy as np
from PIL import Image
class Regular:
def __init__(self):
self.input_image_dir_name = "Images"
self.input_label_dir_name = "Labels"
self.input_ihc_dir_name = "IHC"
self.skip_labels = None
self.labeling_type = 'ihc'
self.first_valid_inst... | none | 1 | 2.819511 | 3 | |
libs/shutdown.py | wombatrace/phpweb | 36 | 6622744 | command = "/usr/bin/sudo /sbin/shutdown -h now"
import subprocess
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
print output | command = "/usr/bin/sudo /sbin/shutdown -h now"
import subprocess
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
print output | none | 1 | 1.995118 | 2 | |
byCourseLectureID/24_Dict-Exer/2.A_Miner_Task.py | shapeshifter789/Fund_PyFu | 0 | 6622745 | <reponame>shapeshifter789/Fund_PyFu
imp = ''
imp_list = list()
imp_dict = dict()
while imp != 'stop':
imp = input()
if imp != 'stop':
imp_list.append(imp)
for i in range(0, len(imp_list), 2):
key = imp_list[i]
value = int(imp_list[i + 1])
if key in imp_dict.keys():
imp_dict[key] += v... | imp = ''
imp_list = list()
imp_dict = dict()
while imp != 'stop':
imp = input()
if imp != 'stop':
imp_list.append(imp)
for i in range(0, len(imp_list), 2):
key = imp_list[i]
value = int(imp_list[i + 1])
if key in imp_dict.keys():
imp_dict[key] += value
else:
imp_dict[key]... | none | 1 | 3.457718 | 3 | |
old/UG/tests/blackbox/syndicate-httpd/PUT.py | jcnelson/syndicate | 16 | 6622746 | <reponame>jcnelson/syndicate
#!/usr/bin/python
import socket
import time
import sys
import urllib2
import os
import base64
auth = "<PASSWORD>:<PASSWORD>"
hostname = sys.argv[1]
port = int(sys.argv[2] )
filename = sys.argv[3]
data_fd = None
data_path = None
if len(sys.argv) > 4:
data_path = sys.argv[4]
data_fd ... | #!/usr/bin/python
import socket
import time
import sys
import urllib2
import os
import base64
auth = "<PASSWORD>:<PASSWORD>"
hostname = sys.argv[1]
port = int(sys.argv[2] )
filename = sys.argv[3]
data_fd = None
data_path = None
if len(sys.argv) > 4:
data_path = sys.argv[4]
data_fd = open( data_path, "r" )
mod... | ru | 0.258958 | #!/usr/bin/python | 2.790037 | 3 |
crosshair/typed_inspect.py | ckeeter/CrossHair | 1 | 6622747 | import os.path
import inspect
import importlib
from typing import *
from crosshair.util import debug, walk_qualname
def _has_annotations(sig: inspect.Signature):
if sig.return_annotation != inspect.Signature.empty:
return True
for p in sig.parameters.values():
if p.annotation != inspect.Parame... | import os.path
import inspect
import importlib
from typing import *
from crosshair.util import debug, walk_qualname
def _has_annotations(sig: inspect.Signature):
if sig.return_annotation != inspect.Signature.empty:
return True
for p in sig.parameters.values():
if p.annotation != inspect.Parame... | en | 0.302682 | #debug('get_resolved_seg input:', sig, next(iter(sig.parameters.keys())), inspect.ismethod(fn)) #debug('TO HINTS ', type_hints) #debug('get_resolved_sig output: ', sig) # raises this for builtins #debug('no pyi at ', pyi_file) #debug('no pyi at ', candidate_file) #debug('pyi found at ', pyi_file) #debug('signature spec... | 2.167172 | 2 |
codeforces/cdf324_2d.py | knuu/competitive-programming | 1 | 6622748 | def miller_rabin(n):
""" primality Test
if n < 3,825,123,056,546,413,051, it is enough to test
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
Complexity: O(log^3 n)
"""
if n == 2:
return True
if n <= 1 or not n & 1:
return False
primes = [2, 3, 5, 7, 11, 13, 17, 19,... | def miller_rabin(n):
""" primality Test
if n < 3,825,123,056,546,413,051, it is enough to test
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
Complexity: O(log^3 n)
"""
if n == 2:
return True
if n <= 1 or not n & 1:
return False
primes = [2, 3, 5, 7, 11, 13, 17, 19,... | en | 0.875265 | primality Test if n < 3,825,123,056,546,413,051, it is enough to test a = 2, 3, 5, 7, 11, 13, 17, 19, and 23. Complexity: O(log^3 n) | 3.710883 | 4 |
gnd-sys/app/cfsinterface/cfeconstants.py | OpenSatKit/cfsat | 12 | 6622749 | """
Copyright 2022 Open STEMware Foundation
All Rights Reserved.
This program is free software; you can modify and/or redistribute it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation; version 3 with attribution addendums as found in the
LICEN... | """
Copyright 2022 Open STEMware Foundation
All Rights Reserved.
This program is free software; you can modify and/or redistribute it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation; version 3 with attribution addendums as found in the
LICEN... | en | 0.790173 | Copyright 2022 Open STEMware Foundation All Rights Reserved. This program is free software; you can modify and/or redistribute it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; version 3 with attribution addendums as found in the LICENSE.txt ... | 1.517423 | 2 |
contents/tts/content/TensorflowTTS/tensorflow_tts/processor/ljspeech.py | PIN-devel/inside-kids | 0 | 6622750 | # -*- coding: utf-8 -*-
# This code is copy and modify from https://github.com/keithito/tacotron.
"""Perform preprocessing and raw feature extraction."""
import re
import os
import numpy as np
import soundfile as sf
from tensorflow_tts.utils import cleaners
_korean_jaso_code = list(range(0x1100, 0x1113)) + list(ran... | # -*- coding: utf-8 -*-
# This code is copy and modify from https://github.com/keithito/tacotron.
"""Perform preprocessing and raw feature extraction."""
import re
import os
import numpy as np
import soundfile as sf
from tensorflow_tts.utils import cleaners
_korean_jaso_code = list(range(0x1100, 0x1113)) + list(ran... | en | 0.790346 | # -*- coding: utf-8 -*- # This code is copy and modify from https://github.com/keithito/tacotron. Perform preprocessing and raw feature extraction. # Export all symbols: # Mappings from symbol to numeric ID and vice versa: LJSpeech processor. # normalize audio signal to be [-1, 1], soundfile already norm. # convert tex... | 2.607715 | 3 |