hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c15694b848f94cf71d67119ecbccff1779b3015 | 286 | py | Python | code8/daili/daili/pipelines.py | weijie88/spider_files | 9039f7ff0f4c76bc5aa80ca8b87b8280880392cc | [
"Apache-2.0"
] | null | null | null | code8/daili/daili/pipelines.py | weijie88/spider_files | 9039f7ff0f4c76bc5aa80ca8b87b8280880392cc | [
"Apache-2.0"
] | null | null | null | code8/daili/daili/pipelines.py | weijie88/spider_files | 9039f7ff0f4c76bc5aa80ca8b87b8280880392cc | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class DailiPipeline(object):
def process_item(self, item, spider):
return item
| 23.833333 | 65 | 0.70979 |
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class DailiPipeline(object):
def process_item(self, item, spider):
return item
| true | true |
1c1569a6c6b8207e182d35819f5eca261bef2695 | 3,240 | py | Python | resources/clte.py | ryandamour/smuggles | fc9aa26ac6237178321d499441b09179959411a3 | [
"BSD-3-Clause"
] | 16 | 2020-09-28T15:54:18.000Z | 2022-03-01T07:18:35.000Z | resources/clte.py | bp0lr/smuggles | fc9aa26ac6237178321d499441b09179959411a3 | [
"BSD-3-Clause"
] | null | null | null | resources/clte.py | bp0lr/smuggles | fc9aa26ac6237178321d499441b09179959411a3 | [
"BSD-3-Clause"
] | 5 | 2020-09-28T15:54:23.000Z | 2021-12-20T18:10:33.000Z | import random
random.seed()
RN = "\r\n"
host = "{{ .Host }}"
num_attacks = 1
num_victim = 30
sleep = 0.01 # Time to sleep between victim requests
# The transfer encoding header to use to cause a desync
smuggle_gadget = "{{ .Mutation }}"
smuggle_method = "{{ .Method }}"
smuggle_path = "{{ .Path }}"
smuggle_host = host... | 32.4 | 147 | 0.66358 | import random
random.seed()
RN = "\r\n"
host = "{{ .Host }}"
num_attacks = 1
num_victim = 30
sleep = 0.01
smuggle_gadget = "{{ .Mutation }}"
smuggle_method = "{{ .Method }}"
smuggle_path = "{{ .Path }}"
smuggle_host = host
smuggle_headers = [
"Connection: close",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win... | true | true |
1c156aaa1d2bb95af692ced55d091747ab649a8b | 397 | py | Python | minghu6_test/algs/count_test.py | minghu6/py-minghu6 | 312bff9c66a0ba936f8600ba019fc514337e92ec | [
"BSD-3-Clause"
] | 2 | 2016-08-23T09:37:34.000Z | 2020-07-05T09:30:57.000Z | minghu6_test/algs/count_test.py | minghu6/minghu6_py | 2874e3302c8910960a3a8cbc874ab32d22d7edaa | [
"BSD-3-Clause"
] | null | null | null | minghu6_test/algs/count_test.py | minghu6/minghu6_py | 2874e3302c8910960a3a8cbc874ab32d22d7edaa | [
"BSD-3-Clause"
] | null | null | null | # -*- coding:utf-8 -*-
# !/usr/bin/env python3
"""
"""
from minghu6.algs import count
def test_Peak():
l1 = [0, 0, 1, 3, 5, 2, 2, 1, 3, 6, 9, 5, 2]
p1 = count.Peak(l1)
res_high = p1.get_peak(count.Peak.HIGH, count.Peak.SORTED_RELATIVE_DISTANCE)
assert res_high[0].index == 4
ass... | 18.045455 | 81 | 0.566751 |
from minghu6.algs import count
def test_Peak():
l1 = [0, 0, 1, 3, 5, 2, 2, 1, 3, 6, 9, 5, 2]
p1 = count.Peak(l1)
res_high = p1.get_peak(count.Peak.HIGH, count.Peak.SORTED_RELATIVE_DISTANCE)
assert res_high[0].index == 4
assert res_high[1].index == 7
if __name__ == '__main__':
... | true | true |
1c156b49c83b1b23a387085935de52e578e7b24a | 5,647 | py | Python | BiLSTM-docker-Python-without-Apache/NERmodel.py | SuperBruceJia/pytorch-flask-deploy-webapp | 114f64c11b64fce378d488f90b2f9743e351e302 | [
"MIT"
] | 16 | 2020-09-10T09:40:56.000Z | 2021-12-28T12:56:25.000Z | BiLSTM-docker-Python-without-Apache/NERmodel.py | hexieshenghuo/pytorch-flask-deploy-webapp | a9484c22ad07f4fb7fa472c34344575e89493a77 | [
"MIT"
] | null | null | null | BiLSTM-docker-Python-without-Apache/NERmodel.py | hexieshenghuo/pytorch-flask-deploy-webapp | a9484c22ad07f4fb7fa472c34344575e89493a77 | [
"MIT"
] | 2 | 2020-12-29T01:44:49.000Z | 2021-01-04T09:38:32.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# import necessary Python Packages
import re
import pickle
import torch
import yaml
from model import BiLSTMCRF
from utils import *
import warnings
import numpy as np
from flask import Flask, request
from flasgger import Swagger
warnings.filterwarnings("ignore")
device =... | 31.027473 | 117 | 0.583141 |
import re
import pickle
import torch
import yaml
from model import BiLSTMCRF
from utils import *
import warnings
import numpy as np
from flask import Flask, request
from flasgger import Swagger
warnings.filterwarnings("ignore")
device = torch.device("cpu")
app = Flask(__name__)
swagger = Swagger(app)
def load_pa... | true | true |
1c156bc2a6d985d8f41e494f400f87385f518272 | 4,744 | py | Python | catalogo/migrations/0001_initial.py | shiminasai/interteam-1 | 1be77a529025a226fb759fb3e04811d854f90f66 | [
"MIT"
] | null | null | null | catalogo/migrations/0001_initial.py | shiminasai/interteam-1 | 1be77a529025a226fb759fb3e04811d854f90f66 | [
"MIT"
] | null | null | null | catalogo/migrations/0001_initial.py | shiminasai/interteam-1 | 1be77a529025a226fb759fb3e04811d854f90f66 | [
"MIT"
] | 3 | 2018-06-07T15:36:04.000Z | 2019-04-01T19:25:43.000Z | # Generated by Django 2.0.5 on 2020-10-19 15:08
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import sorl.thumbnail.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('contrapart... | 40.547009 | 126 | 0.568718 |
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import sorl.thumbnail.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('contrapartes', '0006_departamento'),
migrations.sw... | true | true |
1c156cf34b3030f45b5f5ce9defe4735e7cd573f | 372 | py | Python | task_manager/manager.py | Serrones/task_manager | 6dd7f1b19841929fa96ff41dd2506631663e087b | [
"MIT"
] | null | null | null | task_manager/manager.py | Serrones/task_manager | 6dd7f1b19841929fa96ff41dd2506631663e087b | [
"MIT"
] | null | null | null | task_manager/manager.py | Serrones/task_manager | 6dd7f1b19841929fa96ff41dd2506631663e087b | [
"MIT"
] | null | null | null | from fastapi import FastAPI
from .models import Task, TaskEntry
from uuid import uuid4
app = FastAPI()
TASKS = []
@app.get('/tasks')
def get_list():
return TASKS
@app.post('/tasks', response_model=Task, status_code=201)
def post_task(task: TaskEntry):
new_task = task.dict()
new_task.update({"id": uuid... | 18.6 | 57 | 0.696237 | from fastapi import FastAPI
from .models import Task, TaskEntry
from uuid import uuid4
app = FastAPI()
TASKS = []
@app.get('/tasks')
def get_list():
return TASKS
@app.post('/tasks', response_model=Task, status_code=201)
def post_task(task: TaskEntry):
new_task = task.dict()
new_task.update({"id": uuid... | true | true |
1c156dac61bac08f0b5aaa576d957476794158a8 | 12,088 | py | Python | sdk/python/pulumi_ovh/me_installation_template_partition_scheme.py | tumblewader/pulumi-ovh | fd484de69a247cf4f05c22cf73f1c57b973a1dab | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_ovh/me_installation_template_partition_scheme.py | tumblewader/pulumi-ovh | fd484de69a247cf4f05c22cf73f1c57b973a1dab | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_ovh/me_installation_template_partition_scheme.py | tumblewader/pulumi-ovh | fd484de69a247cf4f05c22cf73f1c57b973a1dab | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 41.82699 | 159 | 0.656271 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = ['MeInstallationTemplatePartitionSchemeArgs', 'MeInstallationTemplatePartitionScheme']
@pulumi.input_type
class MeInstallationTemplatePartitionSchemeArgs:
de... | true | true |
1c156e5f122bf8807853c07fb26f3bbb780b1d00 | 852 | py | Python | tests/test_var.py | caterinaurban/apronpy | 8a7e08e6929beeeeb97a9da648499be8c5d18bff | [
"MIT"
] | 7 | 2019-02-19T18:55:13.000Z | 2019-10-08T10:32:40.000Z | tests/test_var.py | caterinaurban/apronpy | 8a7e08e6929beeeeb97a9da648499be8c5d18bff | [
"MIT"
] | 3 | 2020-05-26T21:08:29.000Z | 2020-08-28T13:10:47.000Z | tests/test_var.py | caterinaurban/apronpy | 8a7e08e6929beeeeb97a9da648499be8c5d18bff | [
"MIT"
] | 1 | 2022-03-29T15:01:27.000Z | 2022-03-29T15:01:27.000Z | """
APRON (String) Variables - Unit Tests
=====================================
:Author: Caterina Urban
"""
import unittest
from copy import deepcopy
from apronpy.var import PyVar
class TestPyVar(unittest.TestCase):
def test_init(self):
self.assertEqual(str(PyVar('x0')), 'x0')
self.assertEqual(... | 23.666667 | 51 | 0.566901 | import unittest
from copy import deepcopy
from apronpy.var import PyVar
class TestPyVar(unittest.TestCase):
def test_init(self):
self.assertEqual(str(PyVar('x0')), 'x0')
self.assertEqual(str(PyVar('X')), 'X')
def test_deepcopy(self):
x0 = PyVar('X')
x1 = deepcopy(x0)
... | true | true |
1c156e9cdcdfc240a14c874ec6d476bf21a0ed71 | 7,760 | py | Python | QUANTAXIS/QAIndicator/base.py | Wilson-G/QUANTAXIS | f98d09df834dc0c559ca1cac7a091cf2f26d6ad7 | [
"MIT"
] | 2 | 2020-03-03T13:58:36.000Z | 2021-01-13T13:05:43.000Z | QUANTAXIS/QAIndicator/base.py | Wilson-G/QUANTAXIS | f98d09df834dc0c559ca1cac7a091cf2f26d6ad7 | [
"MIT"
] | null | null | null | QUANTAXIS/QAIndicator/base.py | Wilson-G/QUANTAXIS | f98d09df834dc0c559ca1cac7a091cf2f26d6ad7 | [
"MIT"
] | 1 | 2020-03-10T11:01:25.000Z | 2020-03-10T11:01:25.000Z | # coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | 24.402516 | 94 | 0.608634 |
from functools import reduce
import math
import numpy as np
import pandas as pd
def EMA(Series, N):
return pd.Series.ewm(Series, span=N, min_periods=N - 1, adjust=True).mean()
def MA(Series, N):
return pd.Series.rolling(Series, N).mean()
def SMA(Series, N, M=1):
ret = []
i = 1
length = le... | true | true |
1c15739289c2e739e09dfaa9606e6a7fd656a3cf | 6,102 | py | Python | contrib/runners/orquesta_runner/orquesta_runner/orquesta_runner.py | shusugmt/st2 | 31da26badfb4ca3fb3e8cae07cfeec4791191afd | [
"Apache-2.0"
] | null | null | null | contrib/runners/orquesta_runner/orquesta_runner/orquesta_runner.py | shusugmt/st2 | 31da26badfb4ca3fb3e8cae07cfeec4791191afd | [
"Apache-2.0"
] | null | null | null | contrib/runners/orquesta_runner/orquesta_runner/orquesta_runner.py | shusugmt/st2 | 31da26badfb4ca3fb3e8cae07cfeec4791191afd | [
"Apache-2.0"
] | null | null | null | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | 34.670455 | 100 | 0.655359 |
from __future__ import absolute_import
import copy
import uuid
from oslo_config import cfg
from orquesta import exceptions as wf_exc
from orquesta import states as wf_states
from st2common.constants import action as ac_const
from st2common import log as logging
from st2common.persistence import execution as ex_db_... | true | true |
1c1573a2c2099eceb3bbdab0308ebc9824e32bec | 42,613 | py | Python | napari/components/viewer_model.py | ppwadhwa/napari | 25756da88a2ee09e8f6723994685e0aa6fbbb5af | [
"BSD-3-Clause"
] | null | null | null | napari/components/viewer_model.py | ppwadhwa/napari | 25756da88a2ee09e8f6723994685e0aa6fbbb5af | [
"BSD-3-Clause"
] | 2 | 2021-05-17T02:15:08.000Z | 2022-03-12T21:19:52.000Z | napari/components/viewer_model.py | ppwadhwa/napari | 25756da88a2ee09e8f6723994685e0aa6fbbb5af | [
"BSD-3-Clause"
] | null | null | null | from __future__ import annotations
import inspect
import itertools
import os
import warnings
from functools import lru_cache
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Optional,
Sequence,
Set,
Tuple,
Union,
)
import numpy as np
from pydantic impor... | 38.355536 | 99 | 0.606294 | from __future__ import annotations
import inspect
import itertools
import os
import warnings
from functools import lru_cache
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Optional,
Sequence,
Set,
Tuple,
Union,
)
import numpy as np
from pydantic impor... | true | true |
1c157489121201de73719bca365ad642ae78d5b8 | 11,077 | py | Python | pgreaper/core/column_list.py | vincentlaucsb/sqlify | cc84be6efef7b904aacc463d5b0211b3e52a8f25 | [
"MIT"
] | 8 | 2017-05-01T10:11:40.000Z | 2017-07-26T08:52:43.000Z | pgreaper/core/column_list.py | vincentlaucsb/pgreaper | cc84be6efef7b904aacc463d5b0211b3e52a8f25 | [
"MIT"
] | 4 | 2017-05-01T13:11:05.000Z | 2017-08-06T06:18:34.000Z | pgreaper/core/column_list.py | vincentlaucsb/sqlify | cc84be6efef7b904aacc463d5b0211b3e52a8f25 | [
"MIT"
] | null | null | null | from pgreaper._globals import strip, resolve_duplicate
from .mappings import CaseInsensitiveDict
from .schema import PY_TYPES
from inspect import signature
from copy import copy
import functools
import warnings
class ColumnList(object):
'''
A class which makes it easier to work with columns
* Supports "m... | 32.200581 | 87 | 0.537781 | from pgreaper._globals import strip, resolve_duplicate
from .mappings import CaseInsensitiveDict
from .schema import PY_TYPES
from inspect import signature
from copy import copy
import functools
import warnings
class ColumnList(object):
__slots__ = ['n_cols', 'table', 'placeholder', '_col_names', '_col_types... | true | true |
1c1574a6d5b2296c361f8fdc6d5521581f06990d | 1,062 | py | Python | PyGitUp/tests/test_returning_to_branch.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | PyGitUp/tests/test_returning_to_branch.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | PyGitUp/tests/test_returning_to_branch.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # System imports
import os
from os.path import join
from git import *
from nose.tools import *
from PyGitUp.tests import basepath, init_master, update_file
test_name = 'returning-to-branch'
new_branch_name = test_name + '.2'
repo_path = join(basepath, test_name + os.sep)
def setup():
master_path, master = init... | 22.595745 | 60 | 0.706215 | import os
from os.path import join
from git import *
from nose.tools import *
from PyGitUp.tests import basepath, init_master, update_file
test_name = 'returning-to-branch'
new_branch_name = test_name + '.2'
repo_path = join(basepath, test_name + os.sep)
def setup():
master_path, master = init_master(test_name... | true | true |
1c157693c690cefbadfa764e4eab81af37891f0e | 3,102 | py | Python | src/relational/merge.py | hinha/kalkula-extension | 57163eaf55d0a734e65afe8af6bb35fe07c03b55 | [
"MIT"
] | null | null | null | src/relational/merge.py | hinha/kalkula-extension | 57163eaf55d0a734e65afe8af6bb35fe07c03b55 | [
"MIT"
] | null | null | null | src/relational/merge.py | hinha/kalkula-extension | 57163eaf55d0a734e65afe8af6bb35fe07c03b55 | [
"MIT"
] | null | null | null | import gc
import pandas as pd
# from google.protobuf import message # garbage collector interface
class DatasetMerge:
def __init__(self, a: list, b: list, head: int):
self.x = a
self.y = b
self.head = head
def read(self):
return pd.DataFrame(self.x), pd.DataFrame(self.y)
... | 33.354839 | 108 | 0.596067 | import gc
import pandas as pd
class DatasetMerge:
def __init__(self, a: list, b: list, head: int):
self.x = a
self.y = b
self.head = head
def read(self):
return pd.DataFrame(self.x), pd.DataFrame(self.y)
def stats(self, colA: str = "", colB: str = "", method: int = 0) ->... | true | true |
1c1576961bfaf65770fd47940e1dc49e91254e5d | 209 | py | Python | pacote-download/atividades-python/fatorial.py | bigmaster112/matheus-python | 865a5420c9d5f5f38f7bba67aea0841c23896cee | [
"MIT"
] | null | null | null | pacote-download/atividades-python/fatorial.py | bigmaster112/matheus-python | 865a5420c9d5f5f38f7bba67aea0841c23896cee | [
"MIT"
] | null | null | null | pacote-download/atividades-python/fatorial.py | bigmaster112/matheus-python | 865a5420c9d5f5f38f7bba67aea0841c23896cee | [
"MIT"
] | null | null | null | numero = int(input('Digite um numero'))
fatorial = numero
contador = 1
while (numero - contador) > 1:
fatorial = fatorial * (numero-contador)
contador +=1
print('O fatorial de ', numero,'é', fatorial) | 26.125 | 45 | 0.674641 | numero = int(input('Digite um numero'))
fatorial = numero
contador = 1
while (numero - contador) > 1:
fatorial = fatorial * (numero-contador)
contador +=1
print('O fatorial de ', numero,'é', fatorial) | true | true |
1c15777421bd556c9232c3c88a88c16c35f8dd45 | 63,417 | py | Python | 3rdparty/spirv-headers/include/spirv/unified1/spirv.py | amrezzd/bgfx | 560669f6c0e19daf8f29e1f085599f0765e4ee35 | [
"BSD-2-Clause"
] | 1 | 2022-03-26T00:53:35.000Z | 2022-03-26T00:53:35.000Z | 3rdparty/spirv-headers/include/spirv/unified1/spirv.py | amrezzd/bgfx | 560669f6c0e19daf8f29e1f085599f0765e4ee35 | [
"BSD-2-Clause"
] | null | null | null | 3rdparty/spirv-headers/include/spirv/unified1/spirv.py | amrezzd/bgfx | 560669f6c0e19daf8f29e1f085599f0765e4ee35 | [
"BSD-2-Clause"
] | null | null | null | # Copyright (c) 2014-2020 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and/or associated documentation files (the "Materials"),
# to deal in the Materials without restriction, including without limitation
# the rights to use, copy, modify, m... | 34.940496 | 89 | 0.594084 |
# while others are mutually exclusive. The mask-like ones have
# "Mask" in their name, and a parallel enum that has the shift
# amount (1 << x) for each corresponding enumerant.
spv = {
'MagicNumber' : 0x07230203,
'Version' : 0x00010600,
'Revision' : 1,
'OpCodeMask' : 0xffff,
'WordCountShift' : ... | true | true |
1c1577edf1fb7d47b6a2a43d5eacad3295b5960f | 24,065 | py | Python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/operations/_virtual_network_taps_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 1 | 2021-06-02T08:01:35.000Z | 2021-06-02T08:01:35.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/operations/_virtual_network_taps_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/operations/_virtual_network_taps_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 1 | 2021-06-03T19:31:10.000Z | 2021-06-03T19:31:10.000Z | # 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 ... | 45.925573 | 166 | 0.667027 |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
from .. import models
class VirtualNetworkTapsOperations(object):
models = models
def __init_... | true | true |
1c157a007e1b77250b9d3620de5accfc86bd7722 | 586 | py | Python | Apps/job/urls.py | LeChatong/beakhub-api | ee8ab5d528d3b6b8386fd15fc263971d20d4ac62 | [
"MIT"
] | null | null | null | Apps/job/urls.py | LeChatong/beakhub-api | ee8ab5d528d3b6b8386fd15fc263971d20d4ac62 | [
"MIT"
] | null | null | null | Apps/job/urls.py | LeChatong/beakhub-api | ee8ab5d528d3b6b8386fd15fc263971d20d4ac62 | [
"MIT"
] | null | null | null | from django.urls import path
from Apps.job.views import (
CategoryListView,
CategoryDetailsView,
JobListCreateView,
JobDetailsView,
PhoneNumberCreateListView)
urlpatterns = [
path(r'', JobListCreateView.as_view(), name='job-create-list'),
path(r'<str:pk>/', JobDetailsView.as_view(), name='... | 34.470588 | 89 | 0.711604 | from django.urls import path
from Apps.job.views import (
CategoryListView,
CategoryDetailsView,
JobListCreateView,
JobDetailsView,
PhoneNumberCreateListView)
urlpatterns = [
path(r'', JobListCreateView.as_view(), name='job-create-list'),
path(r'<str:pk>/', JobDetailsView.as_view(), name='... | true | true |
1c157a6b3870516d2e5b7a1185ca5ea4e79d903e | 4,164 | py | Python | bilbyweb/tests/test_utils.py | ASVO-TAO/SS18B-PLasky | a3c13b05f894fb8cebd5be381c170b8a78adb81a | [
"MIT"
] | null | null | null | bilbyweb/tests/test_utils.py | ASVO-TAO/SS18B-PLasky | a3c13b05f894fb8cebd5be381c170b8a78adb81a | [
"MIT"
] | null | null | null | bilbyweb/tests/test_utils.py | ASVO-TAO/SS18B-PLasky | a3c13b05f894fb8cebd5be381c170b8a78adb81a | [
"MIT"
] | null | null | null | """
Distributed under the MIT License. See LICENSE.txt for more info.
"""
from django.test import (
TestCase,
)
from ..utility.utils import get_readable_size
class TestGetReadableSize(TestCase):
def test_size(self):
"""
Testing the get_readable_size method using different combinations
... | 26.35443 | 73 | 0.570125 |
from django.test import (
TestCase,
)
from ..utility.utils import get_readable_size
class TestGetReadableSize(TestCase):
def test_size(self):
size = 20
expected = '20.0 B'
self.assertEquals(get_readable_size(size), expected)
size = 1024
expected = '1.0 KB'
... | true | true |
1c157c17ccf3e768d10446badaccde3b7c8a6111 | 2,081 | py | Python | ExamManagement/forms.py | AnkushCh/Finalproject | 880d29390043a506c8c4f570b8005b9f4660454b | [
"MIT"
] | 1 | 2020-12-01T09:59:21.000Z | 2020-12-01T09:59:21.000Z | ExamManagement/forms.py | AnkushCh/Finalproject | 880d29390043a506c8c4f570b8005b9f4660454b | [
"MIT"
] | null | null | null | ExamManagement/forms.py | AnkushCh/Finalproject | 880d29390043a506c8c4f570b8005b9f4660454b | [
"MIT"
] | null | null | null | from django import forms
from .models import Exam, MCQQuestion, AttemptedExam, Question
class AddExamForm(forms.ModelForm):
exam_title = forms.CharField(label='Exam Title')
exam_code = forms.IntegerField(label='Exam Code')
exam_marks = forms.IntegerField(label='Exam Marks')
exam_date_time = forms.Date... | 25.691358 | 104 | 0.595387 | from django import forms
from .models import Exam, MCQQuestion, AttemptedExam, Question
class AddExamForm(forms.ModelForm):
exam_title = forms.CharField(label='Exam Title')
exam_code = forms.IntegerField(label='Exam Code')
exam_marks = forms.IntegerField(label='Exam Marks')
exam_date_time = forms.Date... | true | true |
1c157c1bd4fdb44fe8d9e2fda79ab340acf7d0a0 | 376 | py | Python | tests/bundle/test_file_ref.py | semanticarts/ontology-toolk | dcedb2b9c390324aad5cf8dacb6524daa2da756d | [
"Apache-2.0"
] | 17 | 2020-05-13T20:08:39.000Z | 2021-12-26T03:50:53.000Z | tests/bundle/test_file_ref.py | semanticarts/ontology-toolk | dcedb2b9c390324aad5cf8dacb6524daa2da756d | [
"Apache-2.0"
] | 51 | 2020-04-29T12:36:16.000Z | 2022-03-19T00:39:42.000Z | tests/bundle/test_file_ref.py | semanticarts/ontology-toolk | dcedb2b9c390324aad5cf8dacb6524daa2da756d | [
"Apache-2.0"
] | 2 | 2021-07-06T08:16:37.000Z | 2021-11-21T09:54:07.000Z | from tempfile import TemporaryDirectory
from onto_tool import onto_tool
def test_missing_file_reported(caplog):
with TemporaryDirectory() as tempdir:
onto_tool.main([
'bundle', '-v', 'output', tempdir, 'tests/bundle/broken_file_ref.yaml'
])
logs = caplog.text
assert 'missing_... | 25.066667 | 82 | 0.694149 | from tempfile import TemporaryDirectory
from onto_tool import onto_tool
def test_missing_file_reported(caplog):
with TemporaryDirectory() as tempdir:
onto_tool.main([
'bundle', '-v', 'output', tempdir, 'tests/bundle/broken_file_ref.yaml'
])
logs = caplog.text
assert 'missing_... | true | true |
1c157d41ac0a518cf82956b4141e0541b0fd537e | 1,638 | py | Python | Curso-em-video/Aula_98.py | JhonAI13/Curso_python | 27dedb0effa2c26140f46392e993b8e7a27d6eb3 | [
"MIT"
] | null | null | null | Curso-em-video/Aula_98.py | JhonAI13/Curso_python | 27dedb0effa2c26140f46392e993b8e7a27d6eb3 | [
"MIT"
] | null | null | null | Curso-em-video/Aula_98.py | JhonAI13/Curso_python | 27dedb0effa2c26140f46392e993b8e7a27d6eb3 | [
"MIT"
] | null | null | null | # """98: Faça um programa que tenha uma função chamada contador(), que receba três parâmetros: início, fim e passo. Seu programa tem que realizar três contagens através da função criada:
#
# a) de 1 até 10, de 1 em 1
# b) de 10 até 0, de 2 em 2
# c) uma contagem personalizada"""
# from time import sleep
#
#
# def conta... | 22.135135 | 186 | 0.455433 | #
# a) de 1 até 10, de 1 em 1
# b) de 10 até 0, de 2 em 2
# c) uma contagem personalizada"""
from time import sleep
def contagem(a, b, c):
if c < 0:
c += -1
if c == 0:
c = 1
print('-=~' * 20)
print(f'Contagem de {a} até {b} de {c} em {c}.')
if a < b:
cont = a
whil... | true | true |
1c157d4d0927e4c00a900b59a7942182e6ced96d | 8,003 | py | Python | klar_eda/preprocess/csv_preprocess.py | ashish-hacker/klar-EDA | ebb8a440eb01f4111ff9d9c4ead3935b9aa9d07b | [
"MIT"
] | 17 | 2020-09-27T12:18:32.000Z | 2022-02-27T13:54:12.000Z | klar_eda/preprocess/csv_preprocess.py | lekshmissunil/klar-EDA | 32a45854854c92e8e1f642ac31276d6f08daf778 | [
"MIT"
] | 32 | 2020-09-27T18:48:23.000Z | 2022-03-01T04:48:57.000Z | klar_eda/preprocess/csv_preprocess.py | lekshmissunil/klar-EDA | 32a45854854c92e8e1f642ac31276d6f08daf778 | [
"MIT"
] | 27 | 2020-09-27T12:30:38.000Z | 2022-02-24T18:48:30.000Z | # get mean, median, mode, null
# https://scikit-learn.org/stable/modules/preprocessing.html
import pandas as pd
import numpy as np
from .constants import VIZ_ROOT, NUNIQUE_THRESHOLD
from sklearn.preprocessing import OneHotEncoder
from scipy import stats
from sklearn import preprocessing
import datetime
import ... | 43.73224 | 354 | 0.583531 | import pandas as pd
import numpy as np
from .constants import VIZ_ROOT, NUNIQUE_THRESHOLD
from sklearn.preprocessing import OneHotEncoder
from scipy import stats
from sklearn import preprocessing
import datetime
import dateutil.parser
class CSVPreProcess:
def __init__(self, input, target_col = None, ... | true | true |
1c157db462cc1851151035c8ad44416b405fd251 | 514 | py | Python | tests/tools.py | adrianschlatter/tanuna | c94ecb7d5670a90b1d1058b757c65718dfe55496 | [
"BSD-3-Clause"
] | null | null | null | tests/tools.py | adrianschlatter/tanuna | c94ecb7d5670a90b1d1058b757c65718dfe55496 | [
"BSD-3-Clause"
] | 18 | 2015-12-10T20:54:28.000Z | 2016-03-20T16:20:29.000Z | tests/tools.py | adrianschlatter/tanuna | c94ecb7d5670a90b1d1058b757c65718dfe55496 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Stuff that is useful for unittesting.
@author: Adrian Schlatter
"""
import numpy as np
def almostEqual(x, y, tol=1e-10):
"""
Compare 2 array-like objects x and y for "almost equalness". This is
useful for testing numerical computation where you can not expect that
expecte... | 20.56 | 74 | 0.628405 |
import numpy as np
def almostEqual(x, y, tol=1e-10):
x = np.array(x)
y = np.array(y)
if x.shape != y.shape:
return(False)
return(np.sqrt((np.abs(x - y)**2).sum()) < tol)
| true | true |
1c157e929a07beed8fc5854055d81cddd18a5346 | 21,760 | py | Python | gui/ml/keras_processing_tf2.py | case547/acconeer-python-exploration | e92de2c3bc8b60939276128e1ddca47486cdfb54 | [
"BSD-3-Clause-Clear"
] | 117 | 2018-09-19T14:31:55.000Z | 2022-03-21T05:14:53.000Z | gui/ml/keras_processing_tf2.py | case547/acconeer-python-exploration | e92de2c3bc8b60939276128e1ddca47486cdfb54 | [
"BSD-3-Clause-Clear"
] | 100 | 2019-03-11T04:54:54.000Z | 2022-03-23T12:40:05.000Z | gui/ml/keras_processing_tf2.py | case547/acconeer-python-exploration | e92de2c3bc8b60939276128e1ddca47486cdfb54 | [
"BSD-3-Clause-Clear"
] | 52 | 2019-06-16T13:35:29.000Z | 2022-03-07T14:29:13.000Z | import os
import traceback
import numpy as np
import tensorflow as tf
from keras.utils.layer_utils import count_params
from sklearn.model_selection import train_test_split
from sklearn.utils import class_weight
from tensorflow.keras import backend as K
from tensorflow.keras import optimizers as Opt
from tensorflow.ker... | 35.966942 | 97 | 0.537408 | import os
import traceback
import numpy as np
import tensorflow as tf
from keras.utils.layer_utils import count_params
from sklearn.model_selection import train_test_split
from sklearn.utils import class_weight
from tensorflow.keras import backend as K
from tensorflow.keras import optimizers as Opt
from tensorflow.ker... | true | true |
1c157f7deda6bc778bf1b84a0bc41bd6a892ac86 | 7,649 | py | Python | opt.py | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b | [
"Apache-2.0"
] | null | null | null | opt.py | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b | [
"Apache-2.0"
] | null | null | null | opt.py | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b | [
"Apache-2.0"
] | null | null | null | import argparse
import torch
parser = argparse.ArgumentParser(description='PyTorch AlphaPose Training')
"----------------------------- General options -----------------------------"
parser.add_argument('--expID', default='default', type=str,
help='Experiment ID')
parser.add_argument('--dataset', d... | 52.034014 | 96 | 0.569617 | import argparse
import torch
parser = argparse.ArgumentParser(description='PyTorch AlphaPose Training')
parser.add_argument('--expID', default='default', type=str,
help='Experiment ID')
parser.add_argument('--dataset', default='coco', type=str,
help='Dataset choice: mpii | coco... | true | true |
1c157f9d9ffb6f3de6306074449ebc39dde29dce | 2,030 | py | Python | tests_python/daemons/baker.py | callistonianembrace/tezos | d7c25242bd6b0b368c731fc264a112e00f126818 | [
"MIT"
] | 3 | 2021-12-16T20:28:56.000Z | 2022-01-21T01:37:49.000Z | tests_python/daemons/baker.py | callistonianembrace/tezos | d7c25242bd6b0b368c731fc264a112e00f126818 | [
"MIT"
] | 5 | 2022-01-20T21:30:24.000Z | 2022-03-11T14:43:56.000Z | tests_python/daemons/baker.py | Decentralized-Pictures/T4L3NT | 3a9265949d50d2e925b5d6b3df21f283211df6a2 | [
"MIT"
] | 1 | 2021-07-19T07:00:37.000Z | 2021-07-19T07:00:37.000Z | from typing import List
import os
import subprocess
from process import process_utils
# Timeout before killing a baker which doesn't react to SIGTERM
TERM_TIMEOUT = 10
class Baker(subprocess.Popen):
"""Fork a baker process linked to a node and a client"""
def __init__(
self,
baker: str,
... | 32.222222 | 75 | 0.592611 | from typing import List
import os
import subprocess
from process import process_utils
TERM_TIMEOUT = 10
class Baker(subprocess.Popen):
def __init__(
self,
baker: str,
rpc_port: int,
base_dir: str,
node_dir: str,
account: str,
params: List[str] = None,
... | true | true |
1c15800112d5a241aeff1dffd601505b1910fc73 | 19,502 | py | Python | openaq_py.py | AkiBae4891/OpenAQ_Heroku | 61b60c9f31f40df01a8ffa0153d0da6752e0d3ab | [
"MIT"
] | null | null | null | openaq_py.py | AkiBae4891/OpenAQ_Heroku | 61b60c9f31f40df01a8ffa0153d0da6752e0d3ab | [
"MIT"
] | null | null | null | openaq_py.py | AkiBae4891/OpenAQ_Heroku | 61b60c9f31f40df01a8ffa0153d0da6752e0d3ab | [
"MIT"
] | null | null | null | """Simple openaq to only depend on json, math, and requests (no dfs/plots)."""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
import math
class ApiError(Exception):
pass
class API(object):
"""Generic API wrapper object.
"""
def __init__(self, **kwargs):
self._key ... | 36.181818 | 123 | 0.511999 |
import json
import requests
import math
class ApiError(Exception):
pass
class API(object):
def __init__(self, **kwargs):
self._key = kwargs.pop('key', '')
self._pswd = kwargs.pop('pswd', '')
self._version = kwargs.pop('version', None)
self._baseurl = kwargs.pop... | true | true |
1c15801d6570826e630d1c225d46f2ac0810e6af | 3,634 | py | Python | test/testSplit.py | sullyj42/splitwise-csv | e21b337086f253d1633e7a10ab16d19475a72456 | [
"MIT"
] | 14 | 2017-05-03T08:41:57.000Z | 2022-02-20T00:19:26.000Z | test/testSplit.py | sullyj42/splitwise-csv | e21b337086f253d1633e7a10ab16d19475a72456 | [
"MIT"
] | 2 | 2016-10-10T14:52:30.000Z | 2018-04-16T09:32:33.000Z | test/testSplit.py | sullyj42/splitwise-csv | e21b337086f253d1633e7a10ab16d19475a72456 | [
"MIT"
] | 10 | 2016-12-18T10:25:38.000Z | 2022-02-18T04:47:15.000Z | import unittest
import sys
import csv
import subprocess
from datetime import datetime
from money import Money
sys.path.append("../src")
from groupsplit import split, Splitwise
class UtilsTests(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(UtilsTests, self).__init__(*args, **kwargs)
... | 44.864198 | 140 | 0.5776 | import unittest
import sys
import csv
import subprocess
from datetime import datetime
from money import Money
sys.path.append("../src")
from groupsplit import split, Splitwise
class UtilsTests(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(UtilsTests, self).__init__(*args, **kwargs)
... | true | true |
1c1580efa04d6ed73b5377e7d3cf211ca7020a74 | 1,204 | py | Python | Crowdflower Search Results Relevance/src/feat/run_all.py | Tuanlase02874/Machine-Learning-Kaggle | c31651acd8f2407d8b60774e843a2527ce19b013 | [
"MIT"
] | 1 | 2018-07-11T16:20:43.000Z | 2018-07-11T16:20:43.000Z | Crowdflower Search Results Relevance/src/feat/run_all.py | Tuanlase02874/Machine-Learning-Kaggle | c31651acd8f2407d8b60774e843a2527ce19b013 | [
"MIT"
] | null | null | null | Crowdflower Search Results Relevance/src/feat/run_all.py | Tuanlase02874/Machine-Learning-Kaggle | c31651acd8f2407d8b60774e843a2527ce19b013 | [
"MIT"
] | null | null | null | import os
#################
## Preprocesss ##
#################
#### preprocess data
cmd = "python src/feat/preprocess.py"
os.system(cmd)
# #### generate kfold
# cmd = "python ./gen_kfold.py"
# os.system(cmd)
#######################
## Generate features ##
#######################
#### query id
cmd = "python src/feat... | 21.890909 | 81 | 0.653654 | import os
cmd = "python src/feat/preprocess.py"
os.system(cmd)
cmd = "python src/feat/genFeat_id_feat.py"
os.system(cmd)
cmd = "python src/feat/genFeat_counting_feat.py"
os.system(cmd)
cmd = "python src/feat/genFeat_distance_feat.py"
os.system(cmd)
cmd = "python src/feat/genFeat_basic_tfidf_feat.py"
os.system(cmd... | true | true |
1c15810a85b6ea51cb4704ebcd966e6d11dcf262 | 1,340 | py | Python | apps/public/pyrosetta/find_my_glycans.py | SchiefLab/Jade | 791d26892aacf21bca733aa9c1c6ea3f2be51958 | [
"BSD-3-Clause"
] | 5 | 2017-02-24T08:55:51.000Z | 2020-09-01T01:59:33.000Z | apps/public/pyrosetta/find_my_glycans.py | SchiefLab/Jade | 791d26892aacf21bca733aa9c1c6ea3f2be51958 | [
"BSD-3-Clause"
] | 2 | 2020-10-27T21:03:50.000Z | 2021-11-15T17:46:45.000Z | apps/public/pyrosetta/find_my_glycans.py | SchiefLab/Jade | 791d26892aacf21bca733aa9c1c6ea3f2be51958 | [
"BSD-3-Clause"
] | 2 | 2019-08-01T11:21:14.000Z | 2020-09-01T01:59:35.000Z | #!/usr/bin/env python
import pyrosetta
import rosetta
import sys
import os
from argparse import ArgumentParser
#This code finds rosetta numbering of a glycan structure.
#Useful while we figure out this PDBInfo problem...
def get_parser():
parser = ArgumentParser(description="This app is the PyRosetta equivalen... | 32.682927 | 125 | 0.670896 |
import pyrosetta
import rosetta
import sys
import os
from argparse import ArgumentParser
def get_parser():
parser = ArgumentParser(description="This app is the PyRosetta equivalent of GlycanInfo. "
"Print carbohydrate info about the pose. Pass the pose in as an argument")
retu... | false | true |
1c158112eb925add8301b75b5429718da67f1965 | 2,711 | py | Python | Game/utils/Path.py | JulianBautistaVelez/PythonGameArcade | 5bbfaf304063546c5aa673bddfa667eb45503a77 | [
"MIT"
] | null | null | null | Game/utils/Path.py | JulianBautistaVelez/PythonGameArcade | 5bbfaf304063546c5aa673bddfa667eb45503a77 | [
"MIT"
] | null | null | null | Game/utils/Path.py | JulianBautistaVelez/PythonGameArcade | 5bbfaf304063546c5aa673bddfa667eb45503a77 | [
"MIT"
] | null | null | null | import arcade
import copy
from utils.Position import Position
from GameConstants import GameConstants as const
class PathFinder:
@staticmethod
def find_path_only_two_directions(starting_pos: Position, end_pos: Position, grid):
steps = []
current_pos = copy.deepcopy(starting_pos)
game_... | 44.442623 | 110 | 0.616747 | import arcade
import copy
from utils.Position import Position
from GameConstants import GameConstants as const
class PathFinder:
@staticmethod
def find_path_only_two_directions(starting_pos: Position, end_pos: Position, grid):
steps = []
current_pos = copy.deepcopy(starting_pos)
game_... | true | true |
1c158113b2189d4a9bf487223ce9d0fff9608904 | 6,987 | py | Python | selfdrive/car/car_helpers.py | doudoune144/openpilot-1 | 61b8df815ff47c9cf013b0a40fd86357629595d9 | [
"MIT"
] | null | null | null | selfdrive/car/car_helpers.py | doudoune144/openpilot-1 | 61b8df815ff47c9cf013b0a40fd86357629595d9 | [
"MIT"
] | null | null | null | selfdrive/car/car_helpers.py | doudoune144/openpilot-1 | 61b8df815ff47c9cf013b0a40fd86357629595d9 | [
"MIT"
] | null | null | null | import os
import time
from common.params import Params
from common.basedir import BASEDIR
from selfdrive.version import is_comma_remote, is_tested_branch
from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
from selfdrive.car.vin import get_vin, VIN_UNKNOWN
from selfdrive.car.... | 35.287879 | 112 | 0.716473 | import os
import time
from common.params import Params
from common.basedir import BASEDIR
from selfdrive.version import is_comma_remote, is_tested_branch
from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
from selfdrive.car.vin import get_vin, VIN_UNKNOWN
from selfdrive.car.... | true | true |
1c15814b075b2412c8763f180556b38763b2f50d | 181 | py | Python | Python Book/12. Complex Loops/15_number_table/number_table.py | alexanderivanov2/Softuni-Software-Engineering | 8adb96f445f1da17dbb6eded9e9594319154c7e7 | [
"MIT"
] | null | null | null | Python Book/12. Complex Loops/15_number_table/number_table.py | alexanderivanov2/Softuni-Software-Engineering | 8adb96f445f1da17dbb6eded9e9594319154c7e7 | [
"MIT"
] | null | null | null | Python Book/12. Complex Loops/15_number_table/number_table.py | alexanderivanov2/Softuni-Software-Engineering | 8adb96f445f1da17dbb6eded9e9594319154c7e7 | [
"MIT"
] | null | null | null | n = int(input())
for row in range(n):
for col in range(n):
num = row + col + 1
if num > n:
num = n * 2 - num
print(num, end=" ")
print() | 20.111111 | 29 | 0.425414 | n = int(input())
for row in range(n):
for col in range(n):
num = row + col + 1
if num > n:
num = n * 2 - num
print(num, end=" ")
print() | true | true |
1c1581d4aa003e0f01650c7f77352fd4c7151570 | 1,384 | py | Python | xv_leak_tools/test_device/device_discoverers/device_discoverer.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 219 | 2017-12-12T09:42:46.000Z | 2022-03-13T08:25:13.000Z | xv_leak_tools/test_device/device_discoverers/device_discoverer.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 11 | 2017-12-14T08:14:51.000Z | 2021-08-09T18:37:45.000Z | xv_leak_tools/test_device/device_discoverers/device_discoverer.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 45 | 2017-12-14T07:26:36.000Z | 2022-03-11T09:36:56.000Z | import copy
from abc import ABCMeta, abstractmethod
from xv_leak_tools.exception import XVEx
class DeviceDiscoverer(metaclass=ABCMeta):
def __init__(self, context, device_inventory):
self._context = context
self._device_inventory = []
for device in device_inventory:
if device[... | 28.833333 | 91 | 0.614162 | import copy
from abc import ABCMeta, abstractmethod
from xv_leak_tools.exception import XVEx
class DeviceDiscoverer(metaclass=ABCMeta):
def __init__(self, context, device_inventory):
self._context = context
self._device_inventory = []
for device in device_inventory:
if device[... | true | true |
1c1581d8138927f1610f6bdcfdbc33d6f3321fda | 5,012 | py | Python | retired/old_version/original/pygecko/Chatbot.py | gecko-robotics/pygecko | a809593a894d8e591e992455a01aa73d8f7b7981 | [
"MIT"
] | 3 | 2019-06-13T07:52:12.000Z | 2020-07-05T13:28:43.000Z | retired/old_version/original/pygecko/Chatbot.py | walchko/pygecko | a809593a894d8e591e992455a01aa73d8f7b7981 | [
"MIT"
] | 23 | 2017-07-07T01:29:33.000Z | 2018-11-23T18:41:08.000Z | retired/old_version/original/pygecko/Chatbot.py | MomsFriendlyRobotCompany/pygecko | a809593a894d8e591e992455a01aa73d8f7b7981 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
##############################################
# The MIT License (MIT)
# Copyright (c) 2016 Kevin Walchko
# see LICENSE for full details
##############################################
from __future__ import print_function
import re
# import sys
# import os
import random
import time
class Base(... | 20.209677 | 133 | 0.593376 |
from __future__ import print_function
import re
import random
import time
class Base(object):
def analyze(self, txt):
for pattern in self.patterns:
match = re.search(pattern, txt.rstrip(".!?"), re.I) if match:
return match
return False
class Command(Base):
def __init__(self, robot_name='robot'):... | true | true |
1c1582d7b6a701bc4d8024a733d2ab09df124490 | 11,448 | py | Python | keras/optimizers/optimizer_v2/ftrl.py | maybeLee/keras | 793620ae1bdda7e37edd485b034e8962fff57f3e | [
"Apache-2.0"
] | 1 | 2022-03-21T02:42:58.000Z | 2022-03-21T02:42:58.000Z | keras/optimizers/optimizer_v2/ftrl.py | maybeLee/keras | 793620ae1bdda7e37edd485b034e8962fff57f3e | [
"Apache-2.0"
] | 1 | 2022-03-31T16:40:51.000Z | 2022-03-31T16:40:51.000Z | keras/optimizers/optimizer_v2/ftrl.py | maybeLee/keras | 793620ae1bdda7e37edd485b034e8962fff57f3e | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The TensorFlow Authors. 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 applica... | 42.243542 | 103 | 0.691387 |
import tensorflow.compat.v2 as tf
from keras.optimizers.optimizer_v2 import optimizer_v2
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.optimizers.Ftrl')
class Ftrl(optimizer_v2.OptimizerV2):
def __init__(self,
learning_rate=0.001,
learning_rate_power... | true | true |
1c1583bfa4e0fddd8bfffb6ae4c7aceaa6150a36 | 41,214 | py | Python | nova/virt/libvirt/vif.py | j-griffith/nova | 8d9325b525034e6e967818bc8431e91585d8abb7 | [
"Apache-2.0"
] | null | null | null | nova/virt/libvirt/vif.py | j-griffith/nova | 8d9325b525034e6e967818bc8431e91585d8abb7 | [
"Apache-2.0"
] | null | null | null | nova/virt/libvirt/vif.py | j-griffith/nova | 8d9325b525034e6e967818bc8431e91585d8abb7 | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2011 Midokura KK
# Copyright (C) 2011 Nicira, Inc
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
# Copyright 2016 Red Hat, 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... | 40.130477 | 79 | 0.581477 |
import copy
import os
import os_vif
from os_vif import exception as osv_exception
from oslo_concurrency import processutils
from oslo_log import log as logging
import nova.conf
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.network import linux_net
from nova.network import mo... | true | true |
1c1584bc89e04da0e9986d188f4bb7b2665de9f7 | 7,382 | py | Python | climlab/radiation/boltzmann.py | nfeldl/climlab | 2cabb49e2c3f54c1795f24338ef5ee44e49fc7e7 | [
"BSD-3-Clause",
"MIT"
] | 160 | 2015-02-25T15:56:37.000Z | 2022-03-14T23:51:23.000Z | climlab/radiation/boltzmann.py | nfeldl/climlab | 2cabb49e2c3f54c1795f24338ef5ee44e49fc7e7 | [
"BSD-3-Clause",
"MIT"
] | 137 | 2015-12-18T17:39:31.000Z | 2022-02-04T20:50:53.000Z | climlab/radiation/boltzmann.py | nfeldl/climlab | 2cabb49e2c3f54c1795f24338ef5ee44e49fc7e7 | [
"BSD-3-Clause",
"MIT"
] | 54 | 2015-04-28T05:57:39.000Z | 2022-02-17T08:15:11.000Z | from __future__ import division
from climlab import constants as const
from climlab.process.energy_budget import EnergyBudget
class Boltzmann(EnergyBudget):
r"""A class for black body radiation.
Implements a radiation subprocess which computes longwave radiation
with the Stefan-Boltzmann law for black/gr... | 36.91 | 90 | 0.589 | from __future__ import division
from climlab import constants as const
from climlab.process.energy_budget import EnergyBudget
class Boltzmann(EnergyBudget):
def __init__(self, eps= 0.65, tau=0.95, **kwargs):
super(Boltzmann, self).__init__(**kwargs)
self.eps = eps
self.tau = tau
... | true | true |
1c15855e451f151567d80e03de217e19ebfb1d60 | 1,490 | py | Python | 12-nat/nat_topo.py | cebarobot/UCAS-Network-Lab | 4a19a05e39bcc8a1ed4123c03150e344d15c4a31 | [
"MIT"
] | 2 | 2021-11-23T05:25:53.000Z | 2022-02-28T01:41:11.000Z | 12-nat/nat_topo.py | cebarobot/UCAS-Network-Lab | 4a19a05e39bcc8a1ed4123c03150e344d15c4a31 | [
"MIT"
] | null | null | null | 12-nat/nat_topo.py | cebarobot/UCAS-Network-Lab | 4a19a05e39bcc8a1ed4123c03150e344d15c4a31 | [
"MIT"
] | 1 | 2022-02-24T05:56:04.000Z | 2022-02-24T05:56:04.000Z | #!/usr/bin/python
from mininet.node import OVSBridge
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
class NATTopo(Topo):
def build(self):
s1 = self.addSwitch('s1')
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
... | 27.090909 | 70 | 0.601342 |
from mininet.node import OVSBridge
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
class NATTopo(Topo):
def build(self):
s1 = self.addSwitch('s1')
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
n1 = self.add... | true | true |
1c15857cc99cb237b995a2962a64e0ac1c949957 | 772 | py | Python | Buggy_cloth_contact/helper.py | yufeiwang63/bullet3 | 8e5faf69e96e293c0773e24358b9b70ae6a58a9a | [
"Zlib"
] | null | null | null | Buggy_cloth_contact/helper.py | yufeiwang63/bullet3 | 8e5faf69e96e293c0773e24358b9b70ae6a58a9a | [
"Zlib"
] | null | null | null | Buggy_cloth_contact/helper.py | yufeiwang63/bullet3 | 8e5faf69e96e293c0773e24358b9b70ae6a58a9a | [
"Zlib"
] | null | null | null | import numpy as np
import pybullet as p
def create_spheres(id, radius=0.01, mass=0.0, batch_positions=[[0, 0, 0]], visual=True, collision=True, rgba=[0, 1, 1, 1]):
sphere_collision = p.createCollisionShape(shapeType=p.GEOM_SPHERE, radius=radius, physicsClientId=id) if collision else -1
sphere_visual = p.create... | 64.333333 | 232 | 0.787565 | import numpy as np
import pybullet as p
def create_spheres(id, radius=0.01, mass=0.0, batch_positions=[[0, 0, 0]], visual=True, collision=True, rgba=[0, 1, 1, 1]):
sphere_collision = p.createCollisionShape(shapeType=p.GEOM_SPHERE, radius=radius, physicsClientId=id) if collision else -1
sphere_visual = p.create... | true | true |
1c15861505a260d0a09ebcc78ba946b78110cb17 | 305 | py | Python | data/multilingual/Latn.KOO/Serif_16/pdf_to_json_test_Latn.KOO_Serif_16.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | 1 | 2021-09-19T19:47:35.000Z | 2021-09-19T19:47:35.000Z | data/multilingual/Latn.KOO/Serif_16/pdf_to_json_test_Latn.KOO_Serif_16.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | data/multilingual/Latn.KOO/Serif_16/pdf_to_json_test_Latn.KOO_Serif_16.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.KOO/Serif_16/udhr_Latn.KOO_Serif_16.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| 30.5 | 75 | 0.813115 | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.KOO/Serif_16/udhr_Latn.KOO_Serif_16.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| true | true |
1c1586633eeb710baa84cc08e0c0ef4ab7326333 | 10,667 | py | Python | newspaper/urls.py | srik506/newspaper | 4c55552f378fadef8fd92113af1cc675ff191f93 | [
"Apache-2.0",
"MIT"
] | null | null | null | newspaper/urls.py | srik506/newspaper | 4c55552f378fadef8fd92113af1cc675ff191f93 | [
"Apache-2.0",
"MIT"
] | null | null | null | newspaper/urls.py | srik506/newspaper | 4c55552f378fadef8fd92113af1cc675ff191f93 | [
"Apache-2.0",
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Newspaper treats urls for news articles as critical components.
Hence, we have an entire module dedicated to them.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
import re
from urllib.parse import ... | 34.409677 | 131 | 0.593138 | __title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
import re
from urllib.parse import parse_qs, urljoin, urlparse, urlsplit, urlunsplit
from tldextract import tldextract
log = logging.getLogger(__name__)
MAX_FILE_MEMO = 20000
_S... | true | true |
1c15877a87c9e7d81080a58f751baf55c119811f | 694 | py | Python | dashboard/migrations/0015_auto_20200116_1408.py | yuandrew/my-learning-analytics | 9d15d54799ea29d07d04c6dde6e733ec17fb1412 | [
"Apache-2.0"
] | 31 | 2018-11-28T16:45:01.000Z | 2022-01-21T15:28:07.000Z | dashboard/migrations/0015_auto_20200116_1408.py | yuandrew/my-learning-analytics | 9d15d54799ea29d07d04c6dde6e733ec17fb1412 | [
"Apache-2.0"
] | 901 | 2018-11-01T21:11:37.000Z | 2022-03-30T18:58:20.000Z | dashboard/migrations/0015_auto_20200116_1408.py | yuandrew/my-learning-analytics | 9d15d54799ea29d07d04c6dde6e733ec17fb1412 | [
"Apache-2.0"
] | 37 | 2018-11-02T16:53:20.000Z | 2022-03-18T16:45:55.000Z | # Generated by Django 2.2.9 on 2020-01-16 19:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0014_add_auto_field_to_resources'),
]
operations = [
migrations.AddField(
model_name='courseviewoption',
... | 28.916667 | 101 | 0.642651 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0014_add_auto_field_to_resources'),
]
operations = [
migrations.AddField(
model_name='courseviewoption',
name='show_assignment_planning_v1',
... | true | true |
1c1587d2a814fe205ebac7ba59b4e76155e1d3ef | 2,350 | py | Python | ThirdParty/mono/repo/packaging/MacSDK/pcl-reference-assemblies.py | Marsel24/fonline | 83c10c315ea6f2c5ce6a83a608f287d9c619fa9d | [
"MIT"
] | 172 | 2018-10-31T13:47:10.000Z | 2022-02-21T12:08:20.000Z | ThirdParty/mono/repo/packaging/MacSDK/pcl-reference-assemblies.py | rotators/fonline | cd479200c424f220c9b84891621bba48c637df8a | [
"MIT"
] | 51 | 2018-11-01T12:46:25.000Z | 2021-12-14T15:16:15.000Z | ThirdParty/mono/repo/packaging/MacSDK/pcl-reference-assemblies.py | rotators/fonline | cd479200c424f220c9b84891621bba48c637df8a | [
"MIT"
] | 72 | 2018-10-31T13:50:02.000Z | 2022-03-14T09:10:35.000Z | import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='PortableReferenceAssemblies',
version='2014-04-14',
sources=['https://bosstoragemirror.blob.core.wi... | 40.517241 | 144 | 0.593617 | import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='PortableReferenceAssemblies',
version='2014-04-14',
sources=['https://bosstoragemirror.blob.core.wi... | true | true |
1c15894161729e50c11cfb09710583b56d200b65 | 65,324 | py | Python | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/scripts/xsslint/tests/test_linters.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 3 | 2021-12-15T04:58:18.000Z | 2022-02-06T12:15:37.000Z | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/scripts/xsslint/tests/test_linters.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | null | null | null | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/scripts/xsslint/tests/test_linters.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 1 | 2019-01-02T14:38:50.000Z | 2019-01-02T14:38:50.000Z | """
Tests for linters.py
"""
import textwrap
from unittest import TestCase
from ddt import data, ddt
from xsslint.linters import (
JavaScriptLinter, MakoTemplateLinter,
PythonLinter, UnderscoreTemplateLinter,
DjangoTemplateLinter
)
from xsslint.reporting import FileResults
from xsslint.utils import Pars... | 38.584761 | 151 | 0.55736 |
import textwrap
from unittest import TestCase
from ddt import data, ddt
from xsslint.linters import (
JavaScriptLinter, MakoTemplateLinter,
PythonLinter, UnderscoreTemplateLinter,
DjangoTemplateLinter
)
from xsslint.reporting import FileResults
from xsslint.utils import ParseString
UNDERSCORE_LINTER_RU... | true | true |
1c1589caf835265b29baa0765e0a38357e9769b3 | 498 | py | Python | docs/demo/trefoil-knot/trefoil_knot.py | jsmentch/dyneusr | 547927c6817fd89007123c6ec4e87c744397e486 | [
"BSD-3-Clause"
] | 39 | 2019-04-25T21:43:22.000Z | 2022-03-20T10:27:33.000Z | docs/demo/trefoil-knot/trefoil_knot.py | jsmentch/dyneusr | 547927c6817fd89007123c6ec4e87c744397e486 | [
"BSD-3-Clause"
] | 14 | 2019-04-25T21:43:04.000Z | 2021-09-21T18:57:50.000Z | docs/demo/trefoil-knot/trefoil_knot.py | jsmentch/dyneusr | 547927c6817fd89007123c6ec4e87c744397e486 | [
"BSD-3-Clause"
] | 12 | 2019-04-26T23:59:41.000Z | 2022-02-25T16:59:13.000Z | from dyneusr import DyNeuGraph
from dyneusr.datasets import make_trefoil
from kmapper import KeplerMapper
# Generate synthetic dataset
dataset = make_trefoil(size=100)
X = dataset.data
y = dataset.target
# Generate shape graph using KeplerMapper
mapper = KeplerMapper(verbose=1)
lens = mapper.fit_transform(X, proj... | 20.75 | 57 | 0.773092 | from dyneusr import DyNeuGraph
from dyneusr.datasets import make_trefoil
from kmapper import KeplerMapper
dataset = make_trefoil(size=100)
X = dataset.data
y = dataset.target
mapper = KeplerMapper(verbose=1)
lens = mapper.fit_transform(X, projection=[0])
graph = mapper.map(lens, X, nr_cubes=6, overlap_perc=0.2)
... | true | true |
1c1589eb6588cba8eab37202a09f0e3bffe511df | 86,536 | py | Python | BIDS_converter/data2bids.py | Aaronearlerichardson/Cogan_BIDS | 612087ff103566ddf7fc1ebc6a494a0650d2b974 | [
"MIT"
] | 1 | 2021-04-29T18:05:41.000Z | 2021-04-29T18:05:41.000Z | BIDS_converter/data2bids.py | Aaronearlerichardson/Cogan_BIDS | 612087ff103566ddf7fc1ebc6a494a0650d2b974 | [
"MIT"
] | 19 | 2021-04-29T18:27:49.000Z | 2022-02-09T20:38:03.000Z | BIDS_converter/data2bids.py | Aaronearlerichardson/Cogan_BIDS | 612087ff103566ddf7fc1ebc6a494a0650d2b974 | [
"MIT"
] | 1 | 2021-04-29T23:02:01.000Z | 2021-04-29T23:02:01.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import csv
import datetime
import gc
import gzip
import json
import subprocess
import sys
from typing import Union, List
import nibabel as nib
import pandas as pd
import pydicom as dicom
from bids import layout
from matgrab import mat2df
from pyedflib im... | 52.959608 | 172 | 0.475224 |
import argparse
import csv
import datetime
import gc
import gzip
import json
import subprocess
import sys
from typing import Union, List
import nibabel as nib
import pandas as pd
import pydicom as dicom
from bids import layout
from matgrab import mat2df
from pyedflib import highlevel
from scipy.io import wavfile
fr... | true | true |
1c158a00290ce3eda6ec1f310c0a059f8a7955fc | 27,742 | py | Python | ccdproc/tests/test_combiner.py | mwcraig/ccdproc | f67212e60538571aea58ab1cc0b0e169d28cb318 | [
"BSD-3-Clause"
] | 1 | 2017-07-23T05:03:24.000Z | 2017-07-23T05:03:24.000Z | ccdproc/tests/test_combiner.py | mwcraig/ccdproc | f67212e60538571aea58ab1cc0b0e169d28cb318 | [
"BSD-3-Clause"
] | null | null | null | ccdproc/tests/test_combiner.py | mwcraig/ccdproc | f67212e60538571aea58ab1cc0b0e169d28cb318 | [
"BSD-3-Clause"
] | null | null | null | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import astropy.units as u
from astropy.stats import median_absolute_deviation as mad
import pytest
from astropy.utils.data import get_pkg_data_filename
from astropy.nddata import CCDData
from ccdproc.combiner import Combiner, combine... | 37.137885 | 83 | 0.637157 |
import numpy as np
import astropy.units as u
from astropy.stats import median_absolute_deviation as mad
import pytest
from astropy.utils.data import get_pkg_data_filename
from astropy.nddata import CCDData
from ccdproc.combiner import Combiner, combine, _calculate_step_sizes
from ccdproc.image_collection import Ima... | true | true |
1c158a7b2004ce5a3012438571bdd4f7308d1f84 | 5,208 | py | Python | run_final.py | HaritzPuerto/RCGraph | d04fe3e096d7118c9062de2046ecbd6d084c37b6 | [
"CC0-1.0"
] | null | null | null | run_final.py | HaritzPuerto/RCGraph | d04fe3e096d7118c9062de2046ecbd6d084c37b6 | [
"CC0-1.0"
] | null | null | null | run_final.py | HaritzPuerto/RCGraph | d04fe3e096d7118c9062de2046ecbd6d084c37b6 | [
"CC0-1.0"
] | null | null | null | #!/usr/bin/env python
# encoding: utf-8
from richcontext import graph as rc_graph
from typing import Any, Dict, List, Tuple
import argparse
import json
import pprint
import sys
import unicodedata
DEFAULT_PARTITION = None
def propagate_view (pub, graph, override):
"""
propagate a view of this publication -- ... | 29.590909 | 98 | 0.586406 |
from richcontext import graph as rc_graph
from typing import Any, Dict, List, Tuple
import argparse
import json
import pprint
import sys
import unicodedata
DEFAULT_PARTITION = None
def propagate_view (pub, graph, override):
title = pub["title"]
view = {
"title": unicodedata.normalize("NFKD", title)... | true | true |
1c158ac0b40a939193b2f60388209627b2ebb82b | 5,849 | py | Python | bsuite/experiments/cartpole/cartpole.py | NunoEdgarGFlowHub/bsuite | a4bfe48721d8ce1136c4913d2f16015439161362 | [
"Apache-2.0"
] | 2 | 2020-03-11T07:32:03.000Z | 2021-02-17T20:19:03.000Z | bsuite/experiments/cartpole/cartpole.py | NunoEdgarGFlowHub/bsuite | a4bfe48721d8ce1136c4913d2f16015439161362 | [
"Apache-2.0"
] | null | null | null | bsuite/experiments/cartpole/cartpole.py | NunoEdgarGFlowHub/bsuite | a4bfe48721d8ce1136c4913d2f16015439161362 | [
"Apache-2.0"
] | 1 | 2020-09-06T00:35:43.000Z | 2020-09-06T00:35:43.000Z | # pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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/... | 33.614943 | 79 | 0.670542 |
import collections
from bsuite.experiments.cartpole import sweep
import dm_env
from dm_env import specs
import numpy as np
CartpoleState = collections.namedtuple(
'CartpoleState', ['x', 'x_dot', 'theta', 'theta_dot', 'time_elapsed'])
CartpoleConfig = collections.namedtuple(
'CartpoleConfig',
['mass_car... | true | true |
1c158afc0a25109d569190304667cbce61827c59 | 7,591 | py | Python | kubernetes/client/models/v1alpha1_queuing_configuration.py | lp67/python | 33c5ea9835356410ce4a9fa54a02c6a2a22143c6 | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1alpha1_queuing_configuration.py | lp67/python | 33c5ea9835356410ce4a9fa54a02c6a2a22143c6 | [
"Apache-2.0"
] | 4 | 2019-11-19T10:33:47.000Z | 2022-03-01T03:33:52.000Z | kubernetes/client/models/v1alpha1_queuing_configuration.py | mohramadan911/PythonClientAPI | 5d111812c81b7a573ac8661d1aec60bb97072412 | [
"Apache-2.0"
] | 2 | 2021-08-10T16:35:31.000Z | 2021-09-14T04:53:06.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.20
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | 42.407821 | 661 | 0.666052 |
import pprint
import re
import six
from kubernetes.client.configuration import Configuration
class V1alpha1QueuingConfiguration(object):
openapi_types = {
'hand_size': 'int',
'queue_length_limit': 'int',
'queues': 'int'
}
attribute_map = {
'hand_size': 'handSize',
... | true | true |
1c158b8f63dcb9039d9da12181cd1bfa133de289 | 72,805 | py | Python | src/clusterfuzz/_internal/bot/tasks/fuzz_task.py | mspectorgoogle/clusterfuzz | 44df69cbcb94efc212f27758d45d6ff0f36061e5 | [
"Apache-2.0"
] | null | null | null | src/clusterfuzz/_internal/bot/tasks/fuzz_task.py | mspectorgoogle/clusterfuzz | 44df69cbcb94efc212f27758d45d6ff0f36061e5 | [
"Apache-2.0"
] | null | null | null | src/clusterfuzz/_internal/bot/tasks/fuzz_task.py | mspectorgoogle/clusterfuzz | 44df69cbcb94efc212f27758d45d6ff0f36061e5 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# 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, ... | 38.097855 | 80 | 0.715555 |
import collections
from collections import namedtuple
import datetime
import itertools
import os
import random
import re
import time
from typing import List
from google.cloud import ndb
import six
from clusterfuzz._internal.base import dates
from clusterfuzz._internal.base import utils
from clusterfuzz._internal.bot... | true | true |
1c158bc7dfcba5f15ce765ad49c08aa78f4719f0 | 14,909 | py | Python | src/data/get_gdelt.py | AAbercrombie0492/gdelt_distributed_architecture | fd6ab943cbe2e82748c9f74e86d80d4f25498021 | [
"MIT"
] | 7 | 2017-04-28T01:57:49.000Z | 2021-09-04T03:25:38.000Z | src/data/get_gdelt.py | AAbercrombie0492/gdelt_distributed_architecture | fd6ab943cbe2e82748c9f74e86d80d4f25498021 | [
"MIT"
] | null | null | null | src/data/get_gdelt.py | AAbercrombie0492/gdelt_distributed_architecture | fd6ab943cbe2e82748c9f74e86d80d4f25498021 | [
"MIT"
] | 4 | 2017-05-24T20:54:06.000Z | 2020-12-18T12:22:53.000Z | #!/usr/bin/python
'''
Sript to ingest historical gdelt data and save to s3.
'''
# pickle.dump(gkg_columns, open('~/gdelt_distributed_architecture/data/interim/gkg_columns.pkl', 'wb'))
# Import Dependencies
from __future__ import print_function
from __future__ import unicode_literals
import os
import io
import sys
im... | 35.245863 | 138 | 0.597693 |
from __future__ import print_function
from __future__ import unicode_literals
import os
import io
import sys
import time
import zipfile
import requests
import argparse
import datetime
import pandas as pd
import requests
import lxml.html as lh
import numpy as np
import re
from tqdm import tqdm
import pickle
import fa... | true | true |
1c158c3db220643bdfbfee402a254de1794ed1c1 | 13,240 | py | Python | ding/league/player.py | PaParaZz1/DI-engine | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | [
"Apache-2.0"
] | null | null | null | ding/league/player.py | PaParaZz1/DI-engine | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | [
"Apache-2.0"
] | null | null | null | ding/league/player.py | PaParaZz1/DI-engine | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | [
"Apache-2.0"
] | null | null | null | from typing import Callable, Optional, List
from collections import namedtuple
import numpy as np
from easydict import EasyDict
from ding.utils import import_module, PLAYER_REGISTRY
from .algorithm import pfsp
class Player:
"""
Overview:
Base player class, player is the basic member of a league
I... | 40.121212 | 120 | 0.621299 | from typing import Callable, Optional, List
from collections import namedtuple
import numpy as np
from easydict import EasyDict
from ding.utils import import_module, PLAYER_REGISTRY
from .algorithm import pfsp
class Player:
_name = "BasePlayer"
def __init__(
self,
cfg: EasyDict,
... | true | true |
1c158c9c9c5e6da477ec3f657caba10607c11970 | 6,134 | py | Python | recipes/gsl/all/conanfile.py | Tereius/conan-center-index | 6b0523fa57d8e8e890b040e95576f0bc584eeba8 | [
"MIT"
] | 562 | 2019-09-04T12:23:43.000Z | 2022-03-29T16:41:43.000Z | recipes/gsl/all/conanfile.py | Tereius/conan-center-index | 6b0523fa57d8e8e890b040e95576f0bc584eeba8 | [
"MIT"
] | 9,799 | 2019-09-04T12:02:11.000Z | 2022-03-31T23:55:45.000Z | recipes/gsl/all/conanfile.py | Tereius/conan-center-index | 6b0523fa57d8e8e890b040e95576f0bc584eeba8 | [
"MIT"
] | 1,126 | 2019-09-04T11:57:46.000Z | 2022-03-31T16:43:38.000Z | from conans import ConanFile, tools, AutoToolsBuildEnvironment
from contextlib import contextmanager
import os
required_conan_version = ">=1.33.0"
class GslConan(ConanFile):
name = "gsl"
description = "GNU Scientific Library"
homepage = "https://www.gnu.org/software/gsl"
topics = ("numerical", "math",... | 38.578616 | 124 | 0.611836 | from conans import ConanFile, tools, AutoToolsBuildEnvironment
from contextlib import contextmanager
import os
required_conan_version = ">=1.33.0"
class GslConan(ConanFile):
name = "gsl"
description = "GNU Scientific Library"
homepage = "https://www.gnu.org/software/gsl"
topics = ("numerical", "math",... | true | true |
1c158ca538db90812e6db0a9b6393dfd781eb085 | 1,948 | py | Python | cache.py | bossiernesto/python-snipplets | 26e3e7f651d782abc57389b6b88b4bafeb79540f | [
"BSD-3-Clause"
] | null | null | null | cache.py | bossiernesto/python-snipplets | 26e3e7f651d782abc57389b6b88b4bafeb79540f | [
"BSD-3-Clause"
] | null | null | null | cache.py | bossiernesto/python-snipplets | 26e3e7f651d782abc57389b6b88b4bafeb79540f | [
"BSD-3-Clause"
] | null | null | null | import datetime,collections
import functools
CACHE_DURATION=30
def Cache(ttl=CACHE_DURATION):
class _Cache(object):
"""Cache Decorator. Caches a function's return value each time it is called.
If called later with the same arguments, the cached value is returned
(not reevaluated) unless th... | 36.074074 | 96 | 0.586756 | import datetime,collections
import functools
CACHE_DURATION=30
def Cache(ttl=CACHE_DURATION):
class _Cache(object):
def __init__(self, func):
self.func = func
self.cache = {}
self.timestamp={}
self.method_cache = {}
self.method_timestamp={}
... | true | true |
1c158cb3f6efe409876d2a64230f788b8c18a0ba | 124 | py | Python | app/main/views.py | AdrianM0Hdz/OrbitsSimulation | 9f08d049b9a6131d3aa4e6f471bba238f4201964 | [
"MIT"
] | null | null | null | app/main/views.py | AdrianM0Hdz/OrbitsSimulation | 9f08d049b9a6131d3aa4e6f471bba238f4201964 | [
"MIT"
] | null | null | null | app/main/views.py | AdrianM0Hdz/OrbitsSimulation | 9f08d049b9a6131d3aa4e6f471bba238f4201964 | [
"MIT"
] | null | null | null | from flask import render_template
from . import main
@main.route('/')
def index():
return render_template('index.html') | 20.666667 | 40 | 0.733871 | from flask import render_template
from . import main
@main.route('/')
def index():
return render_template('index.html') | true | true |
1c158e215f35f34bd5e3cc07229c240480b3fad0 | 16,195 | py | Python | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/examples/test_models.py | quic-bharathr/aimet | 363308217dca3fc52644bdda31e69e356397adaf | [
"BSD-3-Clause"
] | null | null | null | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/examples/test_models.py | quic-bharathr/aimet | 363308217dca3fc52644bdda31e69e356397adaf | [
"BSD-3-Clause"
] | null | null | null | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/examples/test_models.py | quic-bharathr/aimet | 363308217dca3fc52644bdda31e69e356397adaf | [
"BSD-3-Clause"
] | null | null | null | # /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2020, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification,... | 43.652291 | 117 | 0.651003 |
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dense, Conv2D, BatchNormalization, Flatten, AvgPool2D, MaxPool2D
def single_residual():
inputs = tf.keras.Input(shape=(16, 16, 3,))
x = tf.keras.lay... | true | true |
1c158ea008fad069ab6ab619745c86efd1aa8f54 | 1,536 | py | Python | tests/str/models.py | webjunkie/django | 5dbca13f3baa2e1bafd77e84a80ad6d8a074712e | [
"BSD-3-Clause"
] | 790 | 2015-01-03T02:13:39.000Z | 2020-05-10T19:53:57.000Z | AppServer/lib/django-1.5/tests/modeltests/str/models.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 1,361 | 2015-01-08T23:09:40.000Z | 2020-04-14T00:03:04.000Z | AppServer/lib/django-1.5/tests/modeltests/str/models.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 155 | 2015-01-08T22:59:31.000Z | 2020-04-08T08:01:53.000Z | # -*- coding: utf-8 -*-
"""
2. Adding __str__() or __unicode__() to models
Although it's not a strict requirement, each model should have a
``_str__()`` or ``__unicode__()`` method to return a "human-readable"
representation of the object. Do this not only for your own sanity when dealing
with the interactive prompt, ... | 34.133333 | 79 | 0.741536 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
def __str__(self):
return self.headline
@python_2_unicode_compatible
class Broken... | true | true |
1c158ec4a9995f48e885edb8a1f7aeee164e4883 | 8,770 | py | Python | train_vclr.py | amazon-research/video-contrastive-learning | 9a8d0473fd938dd77dfa6db2762abbc567da040e | [
"Apache-2.0"
] | 123 | 2021-08-04T06:01:51.000Z | 2022-03-24T05:16:01.000Z | train_vclr.py | amazon-research/video-contrastive-learning | 9a8d0473fd938dd77dfa6db2762abbc567da040e | [
"Apache-2.0"
] | 5 | 2021-08-06T14:06:09.000Z | 2022-03-07T20:52:42.000Z | train_vclr.py | amazon-research/video-contrastive-learning | 9a8d0473fd938dd77dfa6db2762abbc567da040e | [
"Apache-2.0"
] | 12 | 2021-08-04T06:01:58.000Z | 2022-03-21T16:40:20.000Z | """The functions for VCLR self-supervised pretraining
Code partially borrowed from
https://github.com/YihengZhang-CV/SeCo-Sequence-Contrastive-Learning/blob/main/train_inter_intra_order.py.
MIT License
Copyright (c) 2020 YihengZhang-CV
"""
import os
import json
import mmcv
import torch
import torch.backends.cudnn as... | 44.974359 | 137 | 0.673432 |
import os
import json
import mmcv
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel
from torch.utils.tensorboard import SummaryWriter
from models.resnet_mlp import resnet50 as resnet50mlp
from models.Contrast import MemorySeCo, Me... | true | true |
1c158f59037f0eb64eebb399b63ebe2521337e30 | 655 | py | Python | juliany_pizza/urls.py | kzborisov/Juliany-Pizza | 4ebc0b21e314b244048df79e4858f30447b43f8b | [
"MIT"
] | null | null | null | juliany_pizza/urls.py | kzborisov/Juliany-Pizza | 4ebc0b21e314b244048df79e4858f30447b43f8b | [
"MIT"
] | 9 | 2022-03-23T13:13:23.000Z | 2022-03-28T13:40:20.000Z | juliany_pizza/urls.py | kzborisov/Juliany-Pizza | 4ebc0b21e314b244048df79e4858f30447b43f8b | [
"MIT"
] | null | null | null | from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from juliany_pizza import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('juliany_pizza.home.urls')),
path('accounts/', in... | 43.666667 | 82 | 0.619847 | from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from juliany_pizza import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('juliany_pizza.home.urls')),
path('accounts/', in... | true | true |
1c1590501ac36dec06f44a6dc16a6140dff21179 | 9,066 | py | Python | openmdao/recorders/tests/test_distrib_sqlite_recorder.py | Dakror/OpenMDAO | 3650622e0e96bed6979991bd096186c85050738f | [
"Apache-2.0"
] | null | null | null | openmdao/recorders/tests/test_distrib_sqlite_recorder.py | Dakror/OpenMDAO | 3650622e0e96bed6979991bd096186c85050738f | [
"Apache-2.0"
] | 1 | 2020-07-20T16:19:35.000Z | 2020-07-20T16:19:35.000Z | openmdao/recorders/tests/test_distrib_sqlite_recorder.py | Dakror/OpenMDAO | 3650622e0e96bed6979991bd096186c85050738f | [
"Apache-2.0"
] | null | null | null | import errno
import os
import unittest
from time import time
from shutil import rmtree
from tempfile import mkdtemp
import numpy as np
from openmdao.utils.general_utils import set_pyoptsparse_opt
from openmdao.utils.mpi import MPI
from openmdao.api import ExecComp, ExplicitComponent, Problem, \
Group, ParallelGr... | 33.955056 | 95 | 0.637657 | import errno
import os
import unittest
from time import time
from shutil import rmtree
from tempfile import mkdtemp
import numpy as np
from openmdao.utils.general_utils import set_pyoptsparse_opt
from openmdao.utils.mpi import MPI
from openmdao.api import ExecComp, ExplicitComponent, Problem, \
Group, ParallelGr... | true | true |
1c15905b6347e7532d425940b349070f4a1b2efa | 11,684 | py | Python | official/vision/beta/projects/yolo/modeling/layers/nn_blocks_test.py | mcasanova1445/models | 37be0fdb4abccca633bb3199a4e6f3f71cd174d9 | [
"Apache-2.0"
] | 1 | 2022-02-02T06:29:41.000Z | 2022-02-02T06:29:41.000Z | official/vision/beta/projects/yolo/modeling/layers/nn_blocks_test.py | mdsaifhaider/models | 7214e17eb425963ec3d0295be215d5d26deaeb32 | [
"Apache-2.0"
] | 8 | 2020-05-19T00:52:30.000Z | 2020-06-04T23:57:20.000Z | official/vision/beta/projects/yolo/modeling/layers/nn_blocks_test.py | mdsaifhaider/models | 7214e17eb425963ec3d0295be215d5d26deaeb32 | [
"Apache-2.0"
] | 2 | 2021-10-07T04:47:04.000Z | 2021-12-18T04:18:19.000Z | # Copyright 2022 The TensorFlow Authors. 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 applica... | 38.058632 | 80 | 0.637367 |
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from official.vision.beta.projects.yolo.modeling.layers import nn_blocks
class CSPConnectTest(tf.test.TestCase, parameterized.TestCase):
@parameterized.named_parameters(('same', 224, 224, 64, 1),
(... | true | true |
1c15909523f4956a19ab6e85a786f0d869723c9b | 383 | py | Python | GOQ/wsgi.py | thephantomcreation/GOQ | 1af92bb1514194bbfdcc4dfd1e3798c273ec974f | [
"MIT"
] | null | null | null | GOQ/wsgi.py | thephantomcreation/GOQ | 1af92bb1514194bbfdcc4dfd1e3798c273ec974f | [
"MIT"
] | null | null | null | GOQ/wsgi.py | thephantomcreation/GOQ | 1af92bb1514194bbfdcc4dfd1e3798c273ec974f | [
"MIT"
] | null | null | null | """
WSGI config for GOQ project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_... | 22.529412 | 78 | 0.780679 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'GOQ.settings')
application = get_wsgi_application()
| true | true |
1c1591fe80c5c4c4cb646c4c801995c84aa3d05a | 14,958 | py | Python | examples/vaisala/app.py | bpptkg/bpptkg-meteo | 8b554c58ffa5bc41377e8bdde7434abaaae49c27 | [
"MIT"
] | null | null | null | examples/vaisala/app.py | bpptkg/bpptkg-meteo | 8b554c58ffa5bc41377e8bdde7434abaaae49c27 | [
"MIT"
] | 2 | 2021-11-22T03:42:28.000Z | 2022-01-13T09:26:06.000Z | examples/vaisala/app.py | bpptkg/bpptkg-meteo | 8b554c58ffa5bc41377e8bdde7434abaaae49c27 | [
"MIT"
] | null | null | null | import argparse
import csv
import datetime
import io
import logging
import logging.config
import os
import sys
import tempfile
from urllib.error import URLError
from urllib.parse import urlencode
from urllib.request import urlopen
import numpy as np
import pandas as pd
import pytz
import sentry_sdk
from decouple impor... | 28.383302 | 91 | 0.576681 | import argparse
import csv
import datetime
import io
import logging
import logging.config
import os
import sys
import tempfile
from urllib.error import URLError
from urllib.parse import urlencode
from urllib.request import urlopen
import numpy as np
import pandas as pd
import pytz
import sentry_sdk
from decouple impor... | true | true |
1c1594f9fcf5265122c6f692d7a118db69ffd4ee | 5,888 | py | Python | dfirtrack_main/tests/generic_views/test_main_overview_urls.py | cclauss/dfirtrack | 2a307c5fe82e927b3c229a20a02bc0c7a5d66d9a | [
"Apache-2.0"
] | null | null | null | dfirtrack_main/tests/generic_views/test_main_overview_urls.py | cclauss/dfirtrack | 2a307c5fe82e927b3c229a20a02bc0c7a5d66d9a | [
"Apache-2.0"
] | null | null | null | dfirtrack_main/tests/generic_views/test_main_overview_urls.py | cclauss/dfirtrack | 2a307c5fe82e927b3c229a20a02bc0c7a5d66d9a | [
"Apache-2.0"
] | null | null | null | import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from dfirtrack_config.models import MainConfigModel
def set_main_overview(main_overview):
""" change config """
model = MainConfigModel.objects.get(main_config_name='MainConfig')... | 34.432749 | 100 | 0.652514 | import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from dfirtrack_config.models import MainConfigModel
def set_main_overview(main_overview):
model = MainConfigModel.objects.get(main_config_name='MainConfig')
model.main_overview =... | true | true |
1c15953496235af7a4f2c641707bbf8d5a6710ca | 6,356 | py | Python | src/file_updater.py | Curtisjk/spotify-playlist-archive | 5521c006b6942b9052b38b0049fce9c20a85cd01 | [
"MIT"
] | null | null | null | src/file_updater.py | Curtisjk/spotify-playlist-archive | 5521c006b6942b9052b38b0049fce9c20a85cd01 | [
"MIT"
] | null | null | null | src/file_updater.py | Curtisjk/spotify-playlist-archive | 5521c006b6942b9052b38b0049fce9c20a85cd01 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import collections
import datetime
import logging
import os
import pathlib
from typing import Dict
from file_formatter import Formatter
from playlist_id import PlaylistID
from spotify import Spotify
from url import URL
logger: logging.Logger = logging.getLogger(__name__)
class FileUpdater:
... | 39.234568 | 87 | 0.602108 |
import collections
import datetime
import logging
import os
import pathlib
from typing import Dict
from file_formatter import Formatter
from playlist_id import PlaylistID
from spotify import Spotify
from url import URL
logger: logging.Logger = logging.getLogger(__name__)
class FileUpdater:
@classmethod
asy... | true | true |
1c159567901cd01cafd828c4c66efa55d476d36f | 16,884 | py | Python | Trabfinal.py | ll0pez10/transmissao-energia-eletrica | 56b9616ff1ab39c34aa5af8c44e7b3ffd1a2f82f | [
"BSD-3-Clause"
] | null | null | null | Trabfinal.py | ll0pez10/transmissao-energia-eletrica | 56b9616ff1ab39c34aa5af8c44e7b3ffd1a2f82f | [
"BSD-3-Clause"
] | null | null | null | Trabfinal.py | ll0pez10/transmissao-energia-eletrica | 56b9616ff1ab39c34aa5af8c44e7b3ffd1a2f82f | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
from linha_transmissao import Linha_transmissao
from metodos_linhas import raio_eq, Pnat, derivacao, quadlinha, compenslinha
from numpy import savetxt
from numpy import sqrt
import numpy as np
from numpy.linalg import inv
import matplotlib.pyplot as plt
np.set_printoptions(linew... | 37.771812 | 146 | 0.584696 |
from linha_transmissao import Linha_transmissao
from metodos_linhas import raio_eq, Pnat, derivacao, quadlinha, compenslinha
from numpy import savetxt
from numpy import sqrt
import numpy as np
from numpy.linalg import inv
import matplotlib.pyplot as plt
np.set_printoptions(linewidth=500)
CondutoresEspecs = {"Bluej... | true | true |
1c159692237224da52f1ccad0533a3dbd78138e5 | 6,098 | py | Python | qa/rpc-tests/proxy_test.py | Open-Biznatch/Marble | 331e4cfbeaec783dfd1cf8210de5b2f03f8be08c | [
"MIT"
] | null | null | null | qa/rpc-tests/proxy_test.py | Open-Biznatch/Marble | 331e4cfbeaec783dfd1cf8210de5b2f03f8be08c | [
"MIT"
] | null | null | null | qa/rpc-tests/proxy_test.py | Open-Biznatch/Marble | 331e4cfbeaec783dfd1cf8210de5b2f03f8be08c | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import socket
import traceback, sys
from binascii import hexlify
import time, os
from socks5 import Socks5Conf... | 41.767123 | 145 | 0.653001 | import socket
import traceback, sys
from binascii import hexlify
import time, os
from socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
from test_framework import BitcoinTestFramework
from util import *
class ProxyTest(BitcoinTestFramework):
def __init__(self):
se... | true | true |
1c15980f2c8c3220e1841df064f08fc44a96f548 | 142 | py | Python | tests/basics/builtin_pow.py | geowor01/micropython | 7fb13eeef4a85f21cae36f1d502bcc53880e1815 | [
"MIT"
] | 7 | 2019-10-18T13:41:39.000Z | 2022-03-15T17:27:57.000Z | tests/basics/builtin_pow.py | geowor01/micropython | 7fb13eeef4a85f21cae36f1d502bcc53880e1815 | [
"MIT"
] | null | null | null | tests/basics/builtin_pow.py | geowor01/micropython | 7fb13eeef4a85f21cae36f1d502bcc53880e1815 | [
"MIT"
] | 2 | 2020-06-23T09:10:15.000Z | 2020-12-22T06:42:14.000Z | # test builtin pow() with integral values
# 2 arg version
print(pow(0, 1))
print(pow(1, 0))
print(pow(-2, 3))
print(pow(3, 8))
print("PASS") | 15.777778 | 41 | 0.647887 |
print(pow(0, 1))
print(pow(1, 0))
print(pow(-2, 3))
print(pow(3, 8))
print("PASS") | true | true |
1c15983d1e2647c13e04422e29f27bb42db1d647 | 15,021 | py | Python | Src/StdLib/Lib/mimify.py | cwensley/ironpython2 | f854444e1e08afc8850cb7c1a739a7dd2d10d32a | [
"Apache-2.0"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | build/cmd/win32/Python27/Lib/mimify.py | IamBaoMouMou/AliOS-Things | 195a9160b871b3d78de6f8cf6c2ab09a71977527 | [
"Apache-2.0"
] | 1,978 | 2017-07-18T09:17:58.000Z | 2022-03-31T14:28:43.000Z | build/cmd/win32/Python27/Lib/mimify.py | IamBaoMouMou/AliOS-Things | 195a9160b871b3d78de6f8cf6c2ab09a71977527 | [
"Apache-2.0"
] | 1,228 | 2017-07-18T09:03:13.000Z | 2022-03-29T05:57:40.000Z | #! /usr/bin/env python
"""Mimification and unmimification of mail messages.
Decode quoted-printable parts of a mail message or encode using
quoted-printable.
Usage:
mimify(input, output)
unmimify(input, output, decode_base64 = 0)
to encode and decode respectively. Input and output may be the name
of... | 32.027719 | 103 | 0.522469 |
"""Mimification and unmimification of mail messages.
Decode quoted-printable parts of a mail message or encode using
quoted-printable.
Usage:
mimify(input, output)
unmimify(input, output, decode_base64 = 0)
to encode and decode respectively. Input and output may be the name
of a file or an open file... | false | true |
1c159857c4f2e49e0ded1649f85cc675a87615a6 | 43 | py | Python | EthMaximalist/custom_indicators/__init__.py | ysdede/jesse_strategies | ade9f4ba42cec11207c766d267b9d8feb8bce648 | [
"CC0-1.0"
] | 38 | 2021-09-18T15:33:28.000Z | 2022-02-21T17:29:08.000Z | EthMaximalist/custom_indicators/__init__.py | ysdede/jesse_strategies | ade9f4ba42cec11207c766d267b9d8feb8bce648 | [
"CC0-1.0"
] | 4 | 2022-01-02T14:46:12.000Z | 2022-02-16T18:39:41.000Z | EthMaximalist/custom_indicators/__init__.py | ysdede/jesse_strategies | ade9f4ba42cec11207c766d267b9d8feb8bce648 | [
"CC0-1.0"
] | 11 | 2021-10-19T06:21:43.000Z | 2022-02-21T17:29:10.000Z | from .ott import ott
from .var import var
| 10.75 | 20 | 0.744186 | from .ott import ott
from .var import var
| true | true |
1c1599440122feea2f1b0bedc903a0608bdf980f | 2,276 | py | Python | grl/sampling.py | taodav/generalization-rl | 9aab3147ef93471fb262d65b75a0688ed083d111 | [
"MIT"
] | 1 | 2021-12-07T10:28:51.000Z | 2021-12-07T10:28:51.000Z | grl/sampling.py | taodav/generalization-rl | 9aab3147ef93471fb262d65b75a0688ed083d111 | [
"MIT"
] | null | null | null | grl/sampling.py | taodav/generalization-rl | 9aab3147ef93471fb262d65b75a0688ed083d111 | [
"MIT"
] | null | null | null | import json
from pathlib import Path
import numpy as np
from typing import List
from definitions import ROOT_DIR
P_OFFSET_MAX = 1.0
P_OFFSET_MIN = -1.0
V_OFFSET_MAX = 1.0
V_OFFSET_MIN = -1.0
def sample_mountaincar_env(seed: int, n: int) -> List[dict]:
"""
Sample n mountain car environment parameters based on... | 30.756757 | 86 | 0.676186 | import json
from pathlib import Path
import numpy as np
from typing import List
from definitions import ROOT_DIR
P_OFFSET_MAX = 1.0
P_OFFSET_MIN = -1.0
V_OFFSET_MAX = 1.0
V_OFFSET_MIN = -1.0
def sample_mountaincar_env(seed: int, n: int) -> List[dict]:
random_state = np.random.RandomState(seed)
all_envs = []
... | true | true |
1c15996dcf85ee0f0fbc0c994389d6cdaedecdd5 | 1,241 | py | Python | dataset_loader.py | ivychill/reid | 6dc8a2ea21dfa8037d26a7184c86e2fb59e3ab9e | [
"MIT"
] | null | null | null | dataset_loader.py | ivychill/reid | 6dc8a2ea21dfa8037d26a7184c86e2fb59e3ab9e | [
"MIT"
] | null | null | null | dataset_loader.py | ivychill/reid | 6dc8a2ea21dfa8037d26a7184c86e2fb59e3ab9e | [
"MIT"
] | null | null | null | # encoding: utf-8
"""
@author: liaoxingyu
@contact: sherlockliao01@gmail.com
"""
import os.path as osp
from PIL import Image
from torch.utils.data import Dataset
def read_image(img_path):
"""Keep reading image until succeed.
This can avoid IOError incurred by heavy IO process."""
got_img = False
if ... | 26.404255 | 109 | 0.629331 |
import os.path as osp
from PIL import Image
from torch.utils.data import Dataset
def read_image(img_path):
got_img = False
if not osp.exists(img_path):
raise IOError("{} does not exist".format(img_path))
while not got_img:
try:
img = Image.open(img_path).convert('RGB')
... | true | true |
1c159a19b76137b989c4f0bbb7f29234dfaf205f | 1,700 | py | Python | runs/cylinder2dRe40/500_markers/scripts/create_mesh_yaml.py | mesnardo/petibm-decoupledibpm | 675615a882cc8418b15a34e1100ccfb421f1d9d1 | [
"BSD-3-Clause"
] | null | null | null | runs/cylinder2dRe40/500_markers/scripts/create_mesh_yaml.py | mesnardo/petibm-decoupledibpm | 675615a882cc8418b15a34e1100ccfb421f1d9d1 | [
"BSD-3-Clause"
] | null | null | null | runs/cylinder2dRe40/500_markers/scripts/create_mesh_yaml.py | mesnardo/petibm-decoupledibpm | 675615a882cc8418b15a34e1100ccfb421f1d9d1 | [
"BSD-3-Clause"
] | null | null | null | """Create a YAML file with info about the structured Cartesian mesh."""
import collections
import pathlib
import petibmpy
simudir = pathlib.Path(__file__).absolute().parents[1]
# Define regions of the grid and grid-spacing size.
Box = collections.namedtuple('Box', ['xstart', 'xend', 'ystart', 'yend'])
box1 = Box(-... | 38.636364 | 77 | 0.674118 |
import collections
import pathlib
import petibmpy
simudir = pathlib.Path(__file__).absolute().parents[1]
Box = collections.namedtuple('Box', ['xstart', 'xend', 'ystart', 'yend'])
box1 = Box(-15.0, 35.0, -25.0, 25.0) box2 = Box(-0.75, 0.75, -0.75, 0.75) width = (box2.xend - box2.xstart) / 90 max_width = 20 * wid... | true | true |
1c159c74908791c79a2e7a5cbcfe67981ab5087e | 1,903 | py | Python | crawler/serv_gcis_nat_gov_tw_moeadsBF/serv_gcis_nat_gov_tw_moeadsBF/plugin.py | SUN-PEI-YUAN/SinicaCrawler | 8fce630ad513cc5124e5c7b19e06a1067e3a1807 | [
"MIT"
] | null | null | null | crawler/serv_gcis_nat_gov_tw_moeadsBF/serv_gcis_nat_gov_tw_moeadsBF/plugin.py | SUN-PEI-YUAN/SinicaCrawler | 8fce630ad513cc5124e5c7b19e06a1067e3a1807 | [
"MIT"
] | null | null | null | crawler/serv_gcis_nat_gov_tw_moeadsBF/serv_gcis_nat_gov_tw_moeadsBF/plugin.py | SUN-PEI-YUAN/SinicaCrawler | 8fce630ad513cc5124e5c7b19e06a1067e3a1807 | [
"MIT"
] | null | null | null | #coding: utf-8
import logging
class Log(object):
'''日誌格式'''
def __init__(self, logger_name, log_fname, init_format, log_format, datefmt, log_level=logging.INFO):
'''Log init setting'''
self.logger_name = logger_name
self.log_fname = log_fname
self.init_format = init_format
... | 38.06 | 105 | 0.600105 | import logging
class Log(object):
def __init__(self, logger_name, log_fname, init_format, log_format, datefmt, log_level=logging.INFO):
self.logger_name = logger_name
self.log_fname = log_fname
self.init_format = init_format
self.log_format = log_format
self.datefmt = datef... | true | true |
1c159cab1da836735989e8207d25a7ba501ab3b0 | 1,389 | py | Python | tools/convert_npy_to_csv.py | aliabdelkader/vkitti3D-dataset | f92f86bcb83e376f5ea0d1e978a0469d8ebc9add | [
"MIT"
] | null | null | null | tools/convert_npy_to_csv.py | aliabdelkader/vkitti3D-dataset | f92f86bcb83e376f5ea0d1e978a0469d8ebc9add | [
"MIT"
] | null | null | null | tools/convert_npy_to_csv.py | aliabdelkader/vkitti3D-dataset | f92f86bcb83e376f5ea0d1e978a0469d8ebc9add | [
"MIT"
] | null | null | null | import numpy as np
from tqdm import tqdm
from pathlib import Path
from concurrent.futures import ProcessPoolExecutor
import argparse
def covert_to_csv(infile):
print(str(infile))
point_cloud = np.load(str(infile)).reshape(-1, channels)
file_name = infile.stem
outfile = output_path / (file_name + '.cs... | 29.553191 | 79 | 0.645068 | import numpy as np
from tqdm import tqdm
from pathlib import Path
from concurrent.futures import ProcessPoolExecutor
import argparse
def covert_to_csv(infile):
print(str(infile))
point_cloud = np.load(str(infile)).reshape(-1, channels)
file_name = infile.stem
outfile = output_path / (file_name + '.cs... | true | true |
1c159d350d62d7260461b17088dfea036eb6b471 | 12,459 | py | Python | frappe/event_streaming/doctype/event_producer/test_event_producer.py | ektai/erp2Dodock | 5ad64b01cba9b07437f9a27751101258679379e8 | [
"MIT"
] | null | null | null | frappe/event_streaming/doctype/event_producer/test_event_producer.py | ektai/erp2Dodock | 5ad64b01cba9b07437f9a27751101258679379e8 | [
"MIT"
] | null | null | null | frappe/event_streaming/doctype/event_producer/test_event_producer.py | ektai/erp2Dodock | 5ad64b01cba9b07437f9a27751101258679379e8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
import json
from frappe.frappeclient import FrappeClient
from frappe.event_streaming.doctype.event_producer.event_producer import pull_from_node
fro... | 34.134247 | 116 | 0.757364 | from __future__ import unicode_literals
import frappe
import unittest
import json
from frappe.frappeclient import FrappeClient
from frappe.event_streaming.doctype.event_producer.event_producer import pull_from_node
from frappe.core.doctype.user.user import generate_keys
producer_url = 'http://test_site_producer:8000'... | true | true |
1c159d4d85b7cb8dd86b0b226ae3ad0c34bb23c8 | 577 | py | Python | cds_ils/importer/providers/cds/importer.py | kpsherva/cds-ils | 8eeeb6e03784756ed24895c8d030682f9d733e8a | [
"MIT"
] | null | null | null | cds_ils/importer/providers/cds/importer.py | kpsherva/cds-ils | 8eeeb6e03784756ed24895c8d030682f9d733e8a | [
"MIT"
] | null | null | null | cds_ils/importer/providers/cds/importer.py | kpsherva/cds-ils | 8eeeb6e03784756ed24895c8d030682f9d733e8a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# CDS-ILS is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""CDS-ILS CDS Importer."""
from cds_ils.importer.documents.api import get_document_by_legacy_recid
from cds_ils.importer... | 27.47619 | 79 | 0.714038 |
from cds_ils.importer.documents.api import get_document_by_legacy_recid
from cds_ils.importer.importer import Importer
class CDSImporter(Importer):
def _match(self):
document = get_document_by_legacy_recid(self.json_data["legacy_recid"])
return document
| true | true |
1c159d7b8516a20974f7b42f17fdfb3a16cc4cf3 | 3,992 | py | Python | Class 3/class3_network_crawl.py | GoreNetwork/Blogs | 5414b0eda71bee2c057dd03c6dc82f770621bf8c | [
"Apache-2.0"
] | null | null | null | Class 3/class3_network_crawl.py | GoreNetwork/Blogs | 5414b0eda71bee2c057dd03c6dc82f770621bf8c | [
"Apache-2.0"
] | null | null | null | Class 3/class3_network_crawl.py | GoreNetwork/Blogs | 5414b0eda71bee2c057dd03c6dc82f770621bf8c | [
"Apache-2.0"
] | null | null | null | from cdp_parse import *
import os
import netmiko
import re
from getpass import getpass
#This is a way to try and make the connections with SSH, if that fails we try telnet, if that fails also it puts an entry in
#Issues.csv and returns a None
def make_connection (ip,username,password):
try:
return netmi... | 35.017544 | 139 | 0.712675 | from cdp_parse import *
import os
import netmiko
import re
from getpass import getpass
def make_connection (ip,username,password):
try:
return netmiko.ConnectHandler(device_type='cisco_ios', ip=ip, username=username, password=password)
except:
try:
return netmiko.ConnectHandler(device_type='cisco... | true | true |
1c159dc05f88c8ee241e80d1e23105d80cecec3f | 1,730 | py | Python | tests/test_parser.py | btharper/pipfile | f9b2626f9d521b766873b58912405c0a2cb00a90 | [
"BSD-2-Clause",
"Apache-2.0"
] | 3,375 | 2016-11-19T04:52:40.000Z | 2022-03-27T09:49:46.000Z | tests/test_parser.py | btharper/pipfile | f9b2626f9d521b766873b58912405c0a2cb00a90 | [
"BSD-2-Clause",
"Apache-2.0"
] | 123 | 2016-11-20T01:38:06.000Z | 2022-03-10T06:28:32.000Z | tests/test_parser.py | btharper/pipfile | f9b2626f9d521b766873b58912405c0a2cb00a90 | [
"BSD-2-Clause",
"Apache-2.0"
] | 178 | 2016-11-19T04:51:20.000Z | 2022-03-27T17:32:13.000Z | import json
import os
from unittest import TestCase, mock
from pipfile.api import PipfileParser
class TestEnvVarInsertion(TestCase):
def setUp(self):
self.p = PipfileParser()
@staticmethod
def example_dict(key):
return {
"a_string": "https://$%s@something.com" % key,
... | 32.641509 | 89 | 0.56763 | import json
import os
from unittest import TestCase, mock
from pipfile.api import PipfileParser
class TestEnvVarInsertion(TestCase):
def setUp(self):
self.p = PipfileParser()
@staticmethod
def example_dict(key):
return {
"a_string": "https://$%s@something.com" % key,
... | true | true |
1c159e1f9fb67637d0de6a45a6664dfe5e9c22ce | 4,413 | py | Python | test/test_ir.py | dcoles/ppci-mirror | 51181db69d933adbb3c5b5ada2bd427d140b1385 | [
"BSD-2-Clause"
] | null | null | null | test/test_ir.py | dcoles/ppci-mirror | 51181db69d933adbb3c5b5ada2bd427d140b1385 | [
"BSD-2-Clause"
] | null | null | null | test/test_ir.py | dcoles/ppci-mirror | 51181db69d933adbb3c5b5ada2bd427d140b1385 | [
"BSD-2-Clause"
] | null | null | null | import unittest
import io
from ppci import ir
from ppci import irutils
from ppci.opt import ConstantFolder
from ppci.binutils.debuginfo import DebugDb
from helper_util import relpath
class IrCodeTestCase(unittest.TestCase):
def test_add(self):
""" See if the ir classes can be constructed """
v1 = ... | 29.61745 | 70 | 0.573986 | import unittest
import io
from ppci import ir
from ppci import irutils
from ppci.opt import ConstantFolder
from ppci.binutils.debuginfo import DebugDb
from helper_util import relpath
class IrCodeTestCase(unittest.TestCase):
def test_add(self):
v1 = ir.Const(1, "const", ir.i32)
v2 = ir.Const(2, "co... | true | true |
1c159ff20170375909adb6b7c2fd2cdfcff34893 | 1,022 | py | Python | discuss/discuss/apps/discuss/migrations/0002_auto_20161125_0525.py | brapastor/djdiscuss | ecd51848b60e974d36da3dd84a1625b99099dfd7 | [
"MIT"
] | null | null | null | discuss/discuss/apps/discuss/migrations/0002_auto_20161125_0525.py | brapastor/djdiscuss | ecd51848b60e974d36da3dd84a1625b99099dfd7 | [
"MIT"
] | null | null | null | discuss/discuss/apps/discuss/migrations/0002_auto_20161125_0525.py | brapastor/djdiscuss | ecd51848b60e974d36da3dd84a1625b99099dfd7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-25 05:25
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('discuss', ... | 30.058824 | 133 | 0.639922 | from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('discuss', '0001_initial'),
]
operations = [
migrations.AddField(
... | true | true |
1c15a1045cc98fad2869d748403e30a029d872cd | 4,858 | py | Python | tests/lamvery/actions/api_test.py | rdtr/lamvery | e9334a0d258c63e6426c7cd320f691b9f21044c1 | [
"MIT"
] | 101 | 2015-11-12T11:29:20.000Z | 2020-05-24T19:26:37.000Z | tests/lamvery/actions/api_test.py | rdtr/lamvery | e9334a0d258c63e6426c7cd320f691b9f21044c1 | [
"MIT"
] | 45 | 2015-11-13T05:43:18.000Z | 2017-04-27T18:14:49.000Z | tests/lamvery/actions/api_test.py | marcy-terui/lamvery | e9334a0d258c63e6426c7cd320f691b9f21044c1 | [
"MIT"
] | 22 | 2016-01-26T00:12:57.000Z | 2019-12-13T09:06:43.000Z | # -*- coding: utf-8 -*-
from unittest import TestCase
from nose.tools import eq_
from mock import Mock
from lamvery.actions.api import (
ApiAction,
DEFAULT_MAPPING_TEMPLATE
)
def default_args():
args = Mock()
args.conf_file = '.lamvery.yml'
args.dry_run = False
args.no_integrate = False
... | 32.824324 | 97 | 0.559078 |
from unittest import TestCase
from nose.tools import eq_
from mock import Mock
from lamvery.actions.api import (
ApiAction,
DEFAULT_MAPPING_TEMPLATE
)
def default_args():
args = Mock()
args.conf_file = '.lamvery.yml'
args.dry_run = False
args.no_integrate = False
args.remove = False
... | true | true |
1c15a1596c9ec9f7650ceff9e0b0d6f7428b2de9 | 470 | py | Python | lc/1437_CheckIf1sAreAtLeastKplacesAway.py | xiangshiyin/coding-challenge | a75a644b96dec1b6c7146b952ca4333263f0a461 | [
"Apache-2.0"
] | null | null | null | lc/1437_CheckIf1sAreAtLeastKplacesAway.py | xiangshiyin/coding-challenge | a75a644b96dec1b6c7146b952ca4333263f0a461 | [
"Apache-2.0"
] | null | null | null | lc/1437_CheckIf1sAreAtLeastKplacesAway.py | xiangshiyin/coding-challenge | a75a644b96dec1b6c7146b952ca4333263f0a461 | [
"Apache-2.0"
] | null | null | null | class Solution:
def kLengthApart(self, nums: List[int], k: int) -> bool:
prev = -1
curr = -1
while curr < len(nums):
if nums[curr] == 0:
curr += 1
else:
if curr - prev - 1 < k and prev != -1:
return... | 23.5 | 60 | 0.329787 | class Solution:
def kLengthApart(self, nums: List[int], k: int) -> bool:
prev = -1
curr = -1
while curr < len(nums):
if nums[curr] == 0:
curr += 1
else:
if curr - prev - 1 < k and prev != -1:
return... | true | true |
1c15a1ae62b1a6154e1e4506a399a68eb954f0bf | 1,381 | py | Python | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py | PlutoniumHeart/ITK | ea3c76c6cd3f87167cbeccc0346253e966a71463 | [
"Apache-2.0"
] | null | null | null | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py | PlutoniumHeart/ITK | ea3c76c6cd3f87167cbeccc0346253e966a71463 | [
"Apache-2.0"
] | null | null | null | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py | PlutoniumHeart/ITK | ea3c76c6cd3f87167cbeccc0346253e966a71463 | [
"Apache-2.0"
] | null | null | null | # Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
"""
defines declarations visitor class interface
"""
class decl_visitor_t(object):
"""
declarations visitor interf... | 23.016667 | 75 | 0.70239 |
class decl_visitor_t(object):
def __init__(self):
object.__init__(self)
def visit_member_function(self):
raise NotImplementedError()
def visit_constructor(self):
raise NotImplementedError()
def visit_destructor(self):
raise NotImplementedError()
def visit_mem... | true | true |
1c15a20c4b6330658b9ec7e32ed8512a1579bd7a | 6,158 | py | Python | hikari/events/member_events.py | fsadav/hikari | 347720d5094e6956bfa68fca7f0ab1c14a694775 | [
"MIT"
] | 3 | 2021-08-28T17:48:52.000Z | 2021-08-29T06:56:12.000Z | hikari/events/member_events.py | Nephael/hikari | 549dd12f4abbc5c42c32680927cdd14049ab3597 | [
"MIT"
] | null | null | null | hikari/events/member_events.py | Nephael/hikari | 549dd12f4abbc5c42c32680927cdd14049ab3597 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# cython: language_level=3
# Copyright (c) 2020 Nekokatt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | 32.930481 | 119 | 0.703475 | from __future__ import annotations
__all__: typing.List[str] = [
"MemberEvent",
"MemberCreateEvent",
"MemberUpdateEvent",
"MemberDeleteEvent",
]
import abc
import typing
import attr
from hikari import intents
from hikari import traits
from hikari.events import base_events
from hikari.events import s... | true | true |
1c15a253f67e2db3c4a15bfa0707c2754c05a4e6 | 1,531 | py | Python | src/app.py | elofaso/CloudResumeChallenge | a8d072dc877ba5cb3ba46b9eda834d6fddb0ba88 | [
"MIT"
] | null | null | null | src/app.py | elofaso/CloudResumeChallenge | a8d072dc877ba5cb3ba46b9eda834d6fddb0ba88 | [
"MIT"
] | null | null | null | src/app.py | elofaso/CloudResumeChallenge | a8d072dc877ba5cb3ba46b9eda834d6fddb0ba88 | [
"MIT"
] | null | null | null | import os
import json
import boto3
import botocore
# Grab data from the environment.
AWS_REGION = os.getenv('AWS_REGION', 'us-east-1')
TABLE_NAME = os.environ['TABLE_NAME']
def lambda_handler(event, context):
db = boto3.resource('dynamodb', region_name=AWS_REGION)
table = db.Table(TABLE_NAME)
visit_c... | 27.339286 | 69 | 0.566297 | import os
import json
import boto3
import botocore
AWS_REGION = os.getenv('AWS_REGION', 'us-east-1')
TABLE_NAME = os.environ['TABLE_NAME']
def lambda_handler(event, context):
db = boto3.resource('dynamodb', region_name=AWS_REGION)
table = db.Table(TABLE_NAME)
visit_count = None
try:
... | true | true |
1c15a2799f8fc17a290a0c3544010739599cec18 | 4,621 | py | Python | tests/tasks/azure/test_blobstorage.py | aliza-miller/prefect | a537e20a8b81192f12a7df575897596347b8a307 | [
"Apache-2.0"
] | null | null | null | tests/tasks/azure/test_blobstorage.py | aliza-miller/prefect | a537e20a8b81192f12a7df575897596347b8a307 | [
"Apache-2.0"
] | null | null | null | tests/tasks/azure/test_blobstorage.py | aliza-miller/prefect | a537e20a8b81192f12a7df575897596347b8a307 | [
"Apache-2.0"
] | null | null | null | from unittest.mock import MagicMock
import pytest
import azure.storage.blob
import prefect
from prefect.tasks.azure import BlobStorageDownload, BlobStorageUpload
from prefect.utilities.configuration import set_temporary_config
class TestBlobStorageDownload:
def test_initialization(self):
task = BlobStor... | 44.009524 | 88 | 0.660463 | from unittest.mock import MagicMock
import pytest
import azure.storage.blob
import prefect
from prefect.tasks.azure import BlobStorageDownload, BlobStorageUpload
from prefect.utilities.configuration import set_temporary_config
class TestBlobStorageDownload:
def test_initialization(self):
task = BlobStor... | true | true |
1c15a29b083b643c632ed1a3629e4e73987ff90d | 5,253 | py | Python | RCNN/training/train.py | PoCFrance/UberPoC | 0c99403e47cd2ea7b07029821ac1997363354b61 | [
"MIT"
] | 8 | 2020-04-09T17:01:48.000Z | 2020-07-02T14:25:04.000Z | RCNN/training/train.py | PoCFrance/UberPoC | 0c99403e47cd2ea7b07029821ac1997363354b61 | [
"MIT"
] | null | null | null | RCNN/training/train.py | PoCFrance/UberPoC | 0c99403e47cd2ea7b07029821ac1997363354b61 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from pyimagesearch import config
from imutils import paths
import numpy as np
import pickle
import os
from keras.applications import MobileNetV2
from keras.models import Sequential
from keras.models import Model
from keras.layers import AveragePooling2D
from keras.layers import Dropout
from kera... | 35.02 | 114 | 0.641729 |
from pyimagesearch import config
from imutils import paths
import numpy as np
import pickle
import os
from keras.applications import MobileNetV2
from keras.models import Sequential
from keras.models import Model
from keras.layers import AveragePooling2D
from keras.layers import Dropout
from keras.layers import Dense
f... | true | true |
1c15a3230b09afef13624cdc591d29353c0ed3be | 1,660 | py | Python | modules/tools/perception/print_perception.py | yuyangapollo/apollo | 8c3daa48edf457efe042207f543d3e165a642ad2 | [
"Apache-2.0"
] | 1 | 2020-04-24T06:14:14.000Z | 2020-04-24T06:14:14.000Z | modules/tools/perception/print_perception.py | Geonhee-LEE/apollo | 3ceaec8843ffe0fb8e821089b2e4708eaf1fa455 | [
"Apache-2.0"
] | 2 | 2018-09-10T03:13:39.000Z | 2018-10-15T16:31:14.000Z | modules/tools/perception/print_perception.py | Geonhee-LEE/apollo | 3ceaec8843ffe0fb8e821089b2e4708eaf1fa455 | [
"Apache-2.0"
] | 3 | 2018-02-03T04:56:22.000Z | 2018-09-14T10:50:53.000Z | #!/usr/bin/env python3
###############################################################################
# Copyright 2019 The Apollo Authors. 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... | 33.2 | 84 | 0.640361 |
import argparse
from cyber_py import cyber
from modules.perception.proto.perception_obstacle_pb2 import PerceptionObstacles
def receiver(data):
print(data)
def perception_receiver(perception_channel):
cyber.init()
node = cyber.Node("perception")
node.create_reader(perception_channel, PerceptionOb... | true | true |
1c15a37e6ac86555323557b11425067c3130cd75 | 7,510 | py | Python | projects/NLR_MEG/forward_session2.py | yeatmanlab/BrainTools | 890db4256b0290918045e53cd3c6fd6197fcbb4e | [
"BSD-3-Clause"
] | 4 | 2019-09-20T13:29:31.000Z | 2021-05-20T00:26:53.000Z | projects/NLR_MEG/forward_session2.py | yeatmanlab/BrainTools | 890db4256b0290918045e53cd3c6fd6197fcbb4e | [
"BSD-3-Clause"
] | 3 | 2016-03-09T22:12:10.000Z | 2016-08-26T15:44:47.000Z | projects/NLR_MEG/forward_session2.py | yeatmanlab/BrainTools | 890db4256b0290918045e53cd3c6fd6197fcbb4e | [
"BSD-3-Clause"
] | 7 | 2015-11-17T06:30:38.000Z | 2022-03-04T05:59:09.000Z | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 12:05:40 2016
@author: sjjoo
"""
import sys
import mne
import matplotlib.pyplot as plt
from mne.utils import run_subprocess, logger
import os
from os import path as op
import copy
import shutil
import numpy as np
from numpy.random import randn
from scipy import stats ... | 35.093458 | 227 | 0.627696 |
import sys
import mne
import matplotlib.pyplot as plt
from mne.utils import run_subprocess, logger
import os
from os import path as op
import copy
import shutil
import numpy as np
from numpy.random import randn
from scipy import stats as stats
import time
from functools import partial
from mne import set_config
set_c... | true | true |
1c15a38ea72ca36472aa14bba938f309c833204d | 1,015 | py | Python | pt/demo/i18n_stub.py | dogada/PyT | a2543176be3c34e231365a974f7724cf0b6684aa | [
"BSD-2-Clause"
] | 6 | 2016-07-22T07:37:18.000Z | 2022-02-08T01:41:29.000Z | pt/demo/i18n_stub.py | dogada/PyT | a2543176be3c34e231365a974f7724cf0b6684aa | [
"BSD-2-Clause"
] | null | null | null | pt/demo/i18n_stub.py | dogada/PyT | a2543176be3c34e231365a974f7724cf0b6684aa | [
"BSD-2-Clause"
] | null | null | null | # coding: utf-8
"""
Dummy implementation of ugettext and translation for 'ru' locale.
"""
locale = 'en'
_translations = {
'ru': {u'Home': u'Начало',
u'Hello, %(user)s!': u'Привет, %(user)s!'},
}
def set_locale(loc):
global locale
locale = loc
def ugettext(message, **params):
"""Dumm... | 24.756098 | 71 | 0.60197 |
locale = 'en'
_translations = {
'ru': {u'Home': u'Начало',
u'Hello, %(user)s!': u'Привет, %(user)s!'},
}
def set_locale(loc):
global locale
locale = loc
def ugettext(message, **params):
_trans = _translations.get(locale, {}).get(message, message)
return _trans % params if params... | true | true |
1c15a484ff7ce3d9a4f5322aeebf4e3316ff5ee3 | 840 | py | Python | datacamp/containers/fancydicts.py | anilgeorge04/learn-ds | f1a9c638e29270d4d72fc3aed0af3ccea8c53350 | [
"MIT"
] | null | null | null | datacamp/containers/fancydicts.py | anilgeorge04/learn-ds | f1a9c638e29270d4d72fc3aed0af3ccea8c53350 | [
"MIT"
] | null | null | null | datacamp/containers/fancydicts.py | anilgeorge04/learn-ds | f1a9c638e29270d4d72fc3aed0af3ccea8c53350 | [
"MIT"
] | null | null | null | # default dictionary
# this skips the step of having to define an empty list when key is missing
from collections import defaultdict
ridership = defaultdict(list)
for date, stop, riders in entries:
ridership[stop].append(riders)
# Print first 10 elements in a dictionary
# Convert dictonary items to list to be abl... | 28 | 75 | 0.778571 | from collections import defaultdict
ridership = defaultdict(list)
for date, stop, riders in entries:
ridership[stop].append(riders)
print(list(ridership.items())[:10])
from collections import OrderedDict
ridership_date = OrderedDict()
print(list(ridership_date.keys())[0])
print(ridership_date.popitem(last=Fal... | true | true |
1c15a527a05acf16dfb1f1a2325354af2ca117fb | 2,861 | py | Python | firmware/pi/nanoReader.py | gokulbalagopal/centralHub | 2d05b74fbd53a3b6dd2a295030215605dabcf42e | [
"CC-BY-3.0"
] | null | null | null | firmware/pi/nanoReader.py | gokulbalagopal/centralHub | 2d05b74fbd53a3b6dd2a295030215605dabcf42e | [
"CC-BY-3.0"
] | 6 | 2020-01-10T20:58:20.000Z | 2020-01-10T21:46:54.000Z | firmware/pi/nanoReader.py | gokulbalagopal/centralHub | 2d05b74fbd53a3b6dd2a295030215605dabcf42e | [
"CC-BY-3.0"
] | 4 | 2020-04-22T22:59:34.000Z | 2021-04-29T17:33:34.000Z | #
import serial
import datetime
from mintsPi import mintsSensorReader as mSR
from mintsPi import mintsDefinitions as mD
import sys
dataFolder = mD.dataFolder
nanoPorts = mD.nanoPorts
baudRate = 9600
def main(portNum):
if(len(nanoPorts)>0):
ser = serial.Serial(
port= nanoPorts[portNum],\
... | 27.509615 | 112 | 0.489689 | import serial
import datetime
from mintsPi import mintsSensorReader as mSR
from mintsPi import mintsDefinitions as mD
import sys
dataFolder = mD.dataFolder
nanoPorts = mD.nanoPorts
baudRate = 9600
def main(portNum):
if(len(nanoPorts)>0):
ser = serial.Serial(
port= nanoPorts[portNum],\
... | true | true |
1c15a5bcdd7bb5c3976153ded15b27725d5dae00 | 4,673 | py | Python | ch9/make_neural_net/threelayersANN.py | bronevet-abc/NLPython | edb2f2c558215df556449c0fafb717d3442cfd9b | [
"MIT"
] | null | null | null | ch9/make_neural_net/threelayersANN.py | bronevet-abc/NLPython | edb2f2c558215df556449c0fafb717d3442cfd9b | [
"MIT"
] | null | null | null | ch9/make_neural_net/threelayersANN.py | bronevet-abc/NLPython | edb2f2c558215df556449c0fafb717d3442cfd9b | [
"MIT"
] | null | null | null | #The credits for this code go to Ludo Bouan.
# I've merely created a wrapper to get people started.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import range
np.seterr(over='ignore')
class NeuralNetwork():
def __init... | 37.99187 | 125 | 0.615022 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import range
np.seterr(over='ignore')
class NeuralNetwork():
def __init__(self):
np.random.seed(1) # Seed the random number generator
self.weights = {} #... | true | true |
1c15a5befff038ec0c7f24967f1b094d543aca69 | 5,798 | py | Python | function/python/brightics/common/validation.py | parkjh80/studio | 6d8d8384272e5e1b2838b12e5557272a19408e89 | [
"Apache-2.0"
] | 202 | 2018-10-23T04:37:35.000Z | 2022-01-27T05:51:10.000Z | function/python/brightics/common/validation.py | data-weirdo/studio | 48852c4f097f773ce3d408b59f79fda2e2d60470 | [
"Apache-2.0"
] | 444 | 2018-11-07T08:41:14.000Z | 2022-03-16T06:48:57.000Z | function/python/brightics/common/validation.py | data-weirdo/studio | 48852c4f097f773ce3d408b59f79fda2e2d60470 | [
"Apache-2.0"
] | 99 | 2018-11-08T04:12:13.000Z | 2022-03-30T05:36:27.000Z | """
Copyright 2019 Samsung SDS
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 ... | 32.943182 | 135 | 0.689203 |
from brightics.common.exception import BrighticsFunctionException
def validate(*bfe):
elist = []
for e in bfe:
if e is not None and type(e) is tuple and len(e) == 2:
elist.append({e[0]: e[1]})
if len(elist) > 0:
print(elist)
raise BrighticsFunctionException.from_errors... | true | true |
1c15a83e7cd784b66c98af731d85c48df6b00b21 | 12,215 | py | Python | qiskit_ibm_runtime/api/clients/runtime.py | rathishcholarajan/qiskit-ibm-runtime | 315a088a844dc8aa4452bde6136b53694dfb3220 | [
"Apache-2.0"
] | null | null | null | qiskit_ibm_runtime/api/clients/runtime.py | rathishcholarajan/qiskit-ibm-runtime | 315a088a844dc8aa4452bde6136b53694dfb3220 | [
"Apache-2.0"
] | null | null | null | qiskit_ibm_runtime/api/clients/runtime.py | rathishcholarajan/qiskit-ibm-runtime | 315a088a844dc8aa4452bde6136b53694dfb3220 | [
"Apache-2.0"
] | null | null | null | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 31.563307 | 97 | 0.588539 |
import logging
from typing import Any, Dict, List, Optional
from datetime import datetime as python_datetime
from qiskit_ibm_runtime.api.session import RetrySession
from .backend import BaseBackendClient
from ..rest.runtime import Runtime
from ..client_parameters import ClientParameters
from ...utils.hgp import fro... | true | true |
1c15a88d9775b3da8fb92518170594afaf398744 | 3,788 | py | Python | torch_datasets/datasets/_setters.py | mingruimingrui/torch-datasets | 2640b8c4fa82156e68e617fc545a546b4e08dc4e | [
"MIT"
] | null | null | null | torch_datasets/datasets/_setters.py | mingruimingrui/torch-datasets | 2640b8c4fa82156e68e617fc545a546b4e08dc4e | [
"MIT"
] | null | null | null | torch_datasets/datasets/_setters.py | mingruimingrui/torch-datasets | 2640b8c4fa82156e68e617fc545a546b4e08dc4e | [
"MIT"
] | null | null | null | """ File to store all Dataset setter functions """
from __future__ import division
def set_classes(self, classes):
""" Sets the classes for this given dataset
Args
classes: List of strings representing all classes
"""
assert len(self.id_to_class_info) == 0, 'Classes appear to already have been... | 32.655172 | 135 | 0.64018 | from __future__ import division
def set_classes(self, classes):
assert len(self.id_to_class_info) == 0, 'Classes appear to already have been set in this dataset, please create new dataset'
for class_id, class_name in enumerate(classes):
class_info = {
'id' : class_id,
'name'... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.