max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
27. Remove Element/solution2.py | sunshot/LeetCode | 0 | 3600 | <gh_stars>0
from typing import List
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
if not nums:
return 0
curr = 0
n = len(nums)
while curr < n:
if nums[curr] == val:
nums[curr] = nums[n-1]
n -= 1
... | from typing import List
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
if not nums:
return 0
curr = 0
n = len(nums)
while curr < n:
if nums[curr] == val:
nums[curr] = nums[n-1]
n -= 1
else... | en | 0.208971 | # print(ans) | 3.729948 | 4 |
platformio/commands/home/run.py | Granjow/platformio-core | 4,744 | 3601 | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | en | 0.838935 | # Copyright (c) 2014-present PlatformIO <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag... | 1.521858 | 2 |
appengine/components/components/machine_provider/rpc_messages.py | stefb965/luci-py | 1 | 3602 | # Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Messages for the Machine Provider API."""
# pylint: disable=unused-wildcard-import, wildcard-import
from protorpc import messages
from compo... | # Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Messages for the Machine Provider API."""
# pylint: disable=unused-wildcard-import, wildcard-import
from protorpc import messages
from compo... | en | 0.870172 | # Copyright 2015 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. Messages for the Machine Provider API. # pylint: disable=unused-wildcard-import, wildcard-import Represents a request to retrieve a machine from th... | 1.901462 | 2 |
webscraping.py | carvalho-fdec/DesafioDSA | 0 | 3603 | <reponame>carvalho-fdec/DesafioDSA
# webscraping test
import urllib.request
from bs4 import BeautifulSoup
with urllib.request.urlopen('http://www.netvasco.com.br') as url:
page = url.read()
#print(page)
print(url.geturl())
print(url.info())
print(url.getcode())
# Analise o html na variável 'page... | # webscraping test
import urllib.request
from bs4 import BeautifulSoup
with urllib.request.urlopen('http://www.netvasco.com.br') as url:
page = url.read()
#print(page)
print(url.geturl())
print(url.info())
print(url.getcode())
# Analise o html na variável 'page' e armazene-o no formato Beautiful... | pt | 0.196564 | # webscraping test #print(page) # Analise o html na variável 'page' e armazene-o no formato Beautiful Soup #print(soup.prettify()) | 3.582746 | 4 |
tensorboard/backend/event_processing/data_provider_test.py | hongxu-jia/tensorboard | 1 | 3604 | # Copyright 2019 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 applicabl... | # Copyright 2019 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 applicabl... | en | 0.878056 | # Copyright 2019 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 applicabl... | 1.414809 | 1 |
extras/amld/cloud/quickdraw_rnn/task.py | luyang1210/tensorflow | 1 | 3605 | <filename>extras/amld/cloud/quickdraw_rnn/task.py
"""Experiment wrapper for training on Cloud ML."""
import argparse, glob, os
import tensorflow as tf
# From this package.
import model
def generate_experiment_fn(data_dir, train_batch_size, eval_batch_size,
train_steps, eval_steps, cell_s... | <filename>extras/amld/cloud/quickdraw_rnn/task.py
"""Experiment wrapper for training on Cloud ML."""
import argparse, glob, os
import tensorflow as tf
# From this package.
import model
def generate_experiment_fn(data_dir, train_batch_size, eval_batch_size,
train_steps, eval_steps, cell_s... | en | 0.811948 | Experiment wrapper for training on Cloud ML. # From this package. Returns experiment_fn for a RNN classifier. Args: data_dir: Where {train,eval}-* tf.train.Example datasets can be found. train_batch_size: Batch size during training. train_batch_size: Batch size during evaluation. train_steps: Number ... | 2.485302 | 2 |
A/116A.py | johnggo/Codeforces-Solutions | 1 | 3606 | <filename>A/116A.py
# Time: 310 ms
# Memory: 1664 KB
n = int(input())
e = 0
s = 0
for i in range(n):
s =s- eval(input().replace(' ', '-'))
e = max(e, s)
print(e)
| <filename>A/116A.py
# Time: 310 ms
# Memory: 1664 KB
n = int(input())
e = 0
s = 0
for i in range(n):
s =s- eval(input().replace(' ', '-'))
e = max(e, s)
print(e)
| en | 0.152962 | # Time: 310 ms # Memory: 1664 KB | 2.888293 | 3 |
tests/test_serialize.py | aferrall/redner | 1,146 | 3607 | import pyredner
import numpy as np
import torch
cam = pyredner.Camera(position = torch.tensor([0.0, 0.0, -5.0]),
look_at = torch.tensor([0.0, 0.0, 0.0]),
up = torch.tensor([0.0, 1.0, 0.0]),
fov = torch.tensor([45.0]), # in degree
c... | import pyredner
import numpy as np
import torch
cam = pyredner.Camera(position = torch.tensor([0.0, 0.0, -5.0]),
look_at = torch.tensor([0.0, 0.0, 0.0]),
up = torch.tensor([0.0, 1.0, 0.0]),
fov = torch.tensor([45.0]), # in degree
c... | en | 0.989802 | # in degree # needs to > 0 | 1.953402 | 2 |
src/zope/publisher/tests/test_requestdataproperty.py | Shoobx/zope.publisher | 3 | 3608 | <reponame>Shoobx/zope.publisher
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should a... | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | en | 0.362335 | ############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH... | 2.313465 | 2 |
tools/scoring/dimensions/__init__.py | ahemphill/digitalbuildings | 0 | 3609 | <reponame>ahemphill/digitalbuildings
""" Enable import """
from os import path
import sys
sys.path.append(
path.abspath(path.join('tools', 'validators', 'instance_validator')))
| """ Enable import """
from os import path
import sys
sys.path.append(
path.abspath(path.join('tools', 'validators', 'instance_validator'))) | en | 0.190585 | Enable import | 1.368743 | 1 |
src/thornfield/caches/cache_compression_decorator.py | drorvinkler/thornfield | 2 | 3610 | from typing import Callable, AnyStr, Optional
from zlib import compress as default_compress, decompress as default_decompress
from .cache import Cache
from ..constants import NOT_FOUND
class CacheCompressionDecorator(Cache):
def __init__(
self,
cache: Cache,
compress: Optional[Callable[[s... | from typing import Callable, AnyStr, Optional
from zlib import compress as default_compress, decompress as default_decompress
from .cache import Cache
from ..constants import NOT_FOUND
class CacheCompressionDecorator(Cache):
def __init__(
self,
cache: Cache,
compress: Optional[Callable[[s... | none | 1 | 2.600225 | 3 | |
manim/mobject/vector_field.py | kdkasad/manim | 2 | 3611 | """Mobjects representing vector fields."""
__all__ = [
"VectorField",
"ArrowVectorField",
"StreamLines",
]
import itertools as it
import random
from math import ceil, floor
from typing import Callable, Iterable, Optional, Sequence, Tuple, Type
import numpy as np
from colour import Color
from PIL import I... | """Mobjects representing vector fields."""
__all__ = [
"VectorField",
"ArrowVectorField",
"StreamLines",
]
import itertools as it
import random
from math import ceil, floor
from typing import Callable, Iterable, Optional, Sequence, Tuple, Type
import numpy as np
from colour import Color
from PIL import I... | en | 0.680501 | Mobjects representing vector fields. A vector field. Vector fields are based on a function defining a vector at every position. This class does by default not include any visible elements but provides methods to move other :class:`~.Mobject` s along the vector field. Parameters ---------- func... | 3.024875 | 3 |
marshmallow_dataclass/__init__.py | dan-starkware/marshmallow_dataclass | 0 | 3612 | """
This library allows the conversion of python 3.7's :mod:`dataclasses`
to :mod:`marshmallow` schemas.
It takes a python class, and generates a marshmallow schema for it.
Simple example::
from marshmallow import Schema
from marshmallow_dataclass import dataclass
@dataclass
class Point:
x:flo... | """
This library allows the conversion of python 3.7's :mod:`dataclasses`
to :mod:`marshmallow` schemas.
It takes a python class, and generates a marshmallow schema for it.
Simple example::
from marshmallow import Schema
from marshmallow_dataclass import dataclass
@dataclass
class Point:
x:flo... | en | 0.541347 | This library allows the conversion of python 3.7's :mod:`dataclasses` to :mod:`marshmallow` schemas. It takes a python class, and generates a marshmallow schema for it. Simple example:: from marshmallow import Schema from marshmallow_dataclass import dataclass @dataclass class Point: x:float ... | 3.084393 | 3 |
electrum_trc/scripts/txradar.py | TheSin-/electrum-trc | 1 | 3613 | <reponame>TheSin-/electrum-trc
#!/usr/bin/env python3
import sys
import asyncio
from electrum_trc.network import filter_protocol, Network
from electrum_trc.util import create_and_start_event_loop, log_exceptions
try:
txid = sys.argv[1]
except:
print("usage: txradar txid")
sys.exit(1)
loop, stopping_fut... | #!/usr/bin/env python3
import sys
import asyncio
from electrum_trc.network import filter_protocol, Network
from electrum_trc.util import create_and_start_event_loop, log_exceptions
try:
txid = sys.argv[1]
except:
print("usage: txradar txid")
sys.exit(1)
loop, stopping_fut, loop_thread = create_and_star... | fr | 0.221828 | #!/usr/bin/env python3 | 2.218476 | 2 |
jp.atcoder/dp/dp_g/24586988.py | kagemeka/atcoder-submissions | 1 | 3614 | import sys
import typing
import numpy as np
def solve(
n: int,
g: np.array,
) -> typing.NoReturn:
indeg = np.zeros(
n,
dtype=np.int64,
)
for v in g[:, 1]:
indeg[v] += 1
g = g[g[:, 0].argsort()]
i = np.searchsorted(
g[:, 0],
np.arange(n + 1)
)
q = [
v for v in range(n)
if... | import sys
import typing
import numpy as np
def solve(
n: int,
g: np.array,
) -> typing.NoReturn:
indeg = np.zeros(
n,
dtype=np.int64,
)
for v in g[:, 1]:
indeg[v] += 1
g = g[g[:, 0].argsort()]
i = np.searchsorted(
g[:, 0],
np.arange(n + 1)
)
q = [
v for v in range(n)
if... | none | 1 | 2.336905 | 2 | |
starteMessung.py | jkerpe/TroubleBubble | 0 | 3615 | <filename>starteMessung.py
from datetime import datetime
from pypylon import pylon
import nimmAuf
import smbus2
import os
import argparse
import bestimmeVolumen
from threading import Thread
import time
programmstart = time.time()
# Argumente parsen (bei Aufruf im Terminal z.B. 'starteMessung.py -n 100' eingeben)
ap =... | <filename>starteMessung.py
from datetime import datetime
from pypylon import pylon
import nimmAuf
import smbus2
import os
import argparse
import bestimmeVolumen
from threading import Thread
import time
programmstart = time.time()
# Argumente parsen (bei Aufruf im Terminal z.B. 'starteMessung.py -n 100' eingeben)
ap =... | de | 0.983758 | # Argumente parsen (bei Aufruf im Terminal z.B. 'starteMessung.py -n 100' eingeben) Skript zum Aufnehmen von Bildern der Teststrecke und der Volumenbestimmung von Luftblasen # Argumente des Parsers extrahieren #Test ob Kamera angeschlossen ist # Test ob Drucksensor angeschlo... | 2.62131 | 3 |
application/services/decart.py | Sapfir0/web-premier-eye | 0 | 3616 | import os
import tempfile
def hasOnePointInside(bigRect, minRect): # хотя бы одна точка лежит внутри
minY, minX, maxY, maxX = bigRect
y1, x1, y2, x2 = minRect
a = (minY <= y1 <= maxY)
b = (minX <= x1 <= maxX)
c = (minY <= y2 <= maxY)
d = (minX <= x2 <= maxX)
return a or b or c or d
d... | import os
import tempfile
def hasOnePointInside(bigRect, minRect): # хотя бы одна точка лежит внутри
minY, minX, maxY, maxX = bigRect
y1, x1, y2, x2 = minRect
a = (minY <= y1 <= maxY)
b = (minX <= x1 <= maxX)
c = (minY <= y2 <= maxY)
d = (minX <= x2 <= maxX)
return a or b or c or d
d... | ru | 0.998749 | # хотя бы одна точка лежит внутри # объект полностью внутри прямоугольника # вроде верно # если тру, то объект полностью внутри большого прямоугольника # объект частично внутри прямоугольника # не уверен что правильно # Не уверен в ифах # почему -? я не знаю # все абсолютно в другом порядке, чем должно быть? что ха дри... | 2.879243 | 3 |
goopylib/objects/_BBox.py | BhavyeMathur/goopylib | 25 | 3617 | from goopylib.objects.GraphicsObject import GraphicsObject
from goopylib.styles import *
class BBox(GraphicsObject):
# Internal base class for objects represented by bounding box
# (opposite corners) Line segment is a degenerate case.
resizing_objects = []
def __init__(self, p1, p2, bounds=None, fi... | from goopylib.objects.GraphicsObject import GraphicsObject
from goopylib.styles import *
class BBox(GraphicsObject):
# Internal base class for objects represented by bounding box
# (opposite corners) Line segment is a degenerate case.
resizing_objects = []
def __init__(self, p1, p2, bounds=None, fi... | en | 0.745003 | # Internal base class for objects represented by bounding box # (opposite corners) Line segment is a degenerate case. # These make sure that the p2 is 'after' p1, ie the x & y value of p2 is greater than that of p1 # Checking if p1's x value is greater than p2's. If so, then swap the values # Checking if p1's y value i... | 2.803082 | 3 |
Graph/DFS&BFS.py | Mayner0220/Programmers | 1 | 3618 | # https://www.acmicpc.net/problem/1260
n, m, v = map(int, input().split())
graph = [[0] * (n+1) for _ in range(n+1)]
visit = [False] * (n+1)
for _ in range(m):
R, C = map(int, input().split())
graph[R][C] = 1
graph[C][R] = 1
def dfs(v):
visit[v] = True
print(v, end=" ")
for i in range(1, n+... | # https://www.acmicpc.net/problem/1260
n, m, v = map(int, input().split())
graph = [[0] * (n+1) for _ in range(n+1)]
visit = [False] * (n+1)
for _ in range(m):
R, C = map(int, input().split())
graph[R][C] = 1
graph[C][R] = 1
def dfs(v):
visit[v] = True
print(v, end=" ")
for i in range(1, n+... | en | 0.613004 | # https://www.acmicpc.net/problem/1260 | 3.17405 | 3 |
coding_intereview/1576. Replace All ?'s to Avoid Consecutive Repeating Characters.py | Jahidul007/Python-Bootcamp | 2 | 3619 | class Solution:
def modifyString(self, s: str) -> str:
s = list(s)
for i in range(len(s)):
if s[i] == "?":
for c in "abc":
if (i == 0 or s[i-1] != c) and (i+1 == len(s) or s[i+1] != c):
s[i] = c
break ... | class Solution:
def modifyString(self, s: str) -> str:
s = list(s)
for i in range(len(s)):
if s[i] == "?":
for c in "abc":
if (i == 0 or s[i-1] != c) and (i+1 == len(s) or s[i+1] != c):
s[i] = c
break ... | none | 1 | 3.439157 | 3 | |
pysteps/tests/helpers.py | Fangyh09/pysteps | 6 | 3620 | <reponame>Fangyh09/pysteps
"""
Testing helper functions
=======================
Collection of helper functions for the testing suite.
"""
from datetime import datetime
import numpy as np
import pytest
import pysteps as stp
from pysteps import io, rcparams
def get_precipitation_fields(num_prev_files=0):
"""Get ... | """
Testing helper functions
=======================
Collection of helper functions for the testing suite.
"""
from datetime import datetime
import numpy as np
import pytest
import pysteps as stp
from pysteps import io, rcparams
def get_precipitation_fields(num_prev_files=0):
"""Get a precipitation field from ... | en | 0.76721 | Testing helper functions ======================= Collection of helper functions for the testing suite. Get a precipitation field from the archive to be used as reference. # Selected case # Find the input files from the archive # Read the radar composites # Not used # Remove time dimension # Convert to mm/h # Mask inva... | 2.400906 | 2 |
modules/courses/courses.py | ehiller/mobilecsp-v18 | 0 | 3621 | <reponame>ehiller/mobilecsp-v18<filename>modules/courses/courses.py
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | # Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | en | 0.810204 | # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ... | 1.693486 | 2 |
packages/merlin/protocols/PrefixLayout.py | pyre/pyre | 25 | 3622 | <gh_stars>10-100
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# (c) 1998-2021 all rights reserved
# support
import merlin
# the manager of intermediate and final build products
class PrefixLayout(merlin.protocol, family="merlin.layouts.prefix"):
"""
The manager of the all build products, both final and inte... | # -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# (c) 1998-2021 all rights reserved
# support
import merlin
# the manager of intermediate and final build products
class PrefixLayout(merlin.protocol, family="merlin.layouts.prefix"):
"""
The manager of the all build products, both final and intermediate disposab... | en | 0.755129 | # -*- coding: utf-8 -*- # # <NAME> <<EMAIL>> # (c) 1998-2021 all rights reserved # support # the manager of intermediate and final build products The manager of the all build products, both final and intermediate disposables # required state # framework hooks Specify the default implementation # choose the default impl... | 1.974698 | 2 |
test/IECoreMaya/ImageConverterTest.py | bradleyhenke/cortex | 386 | 3623 | <reponame>bradleyhenke/cortex
##########################################################################
#
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ar... | ##########################################################################
#
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | en | 0.619043 | ########################################################################## # # Copyright (c) 2011, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistribu... | 1.079696 | 1 |
tests/core_ptl/check_for_ranks.py | PatrykNeubauer/NeMo | 2 | 3624 | <filename>tests/core_ptl/check_for_ranks.py
# Copyright (c) 2021, NVIDIA CORPORATION. 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/licen... | <filename>tests/core_ptl/check_for_ranks.py
# Copyright (c) 2021, NVIDIA CORPORATION. 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/licen... | en | 0.842291 | # Copyright (c) 2021, NVIDIA CORPORATION. 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 appli... | 2.142878 | 2 |
helpers/json_manager.py | Lofi-Lemonade/Python-Discord-Bot-Template | 0 | 3625 | <gh_stars>0
""""
Copyright © Krypton 2022 - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
This is a template to create your own discord bot in python.
Version: 4.1
"""
import json
def add_user_to_blacklist(user_id: int) -> None:
"""
This function will add a user based on its ID in the bl... | """"
Copyright © Krypton 2022 - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
This is a template to create your own discord bot in python.
Version: 4.1
"""
import json
def add_user_to_blacklist(user_id: int) -> None:
"""
This function will add a user based on its ID in the blacklist.json... | en | 0.832191 | " Copyright © Krypton 2022 - https://github.com/kkrypt0nn (https://krypton.ninja) Description: This is a template to create your own discord bot in python. Version: 4.1 This function will add a user based on its ID in the blacklist.json file. :param user_id: The ID of the user that should be added into the blackli... | 3.320144 | 3 |
tests/test_common.py | ColinKennedy/ways | 2 | 3626 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Make sure that generic functions work exactly as we expect.'''
# IMPORT STANDARD LIBRARIES
import unittest
# IMPORT WAYS LIBRARIES
from ways import common
class ParseTestCase(unittest.TestCase):
'''Test generic parsing-related functions.'''
def test_workin... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Make sure that generic functions work exactly as we expect.'''
# IMPORT STANDARD LIBRARIES
import unittest
# IMPORT WAYS LIBRARIES
from ways import common
class ParseTestCase(unittest.TestCase):
'''Test generic parsing-related functions.'''
def test_workin... | en | 0.889575 | #!/usr/bin/env python # -*- coding: utf-8 -*- Make sure that generic functions work exactly as we expect. # IMPORT STANDARD LIBRARIES # IMPORT WAYS LIBRARIES Test generic parsing-related functions. Test that correct input for expand_string works as expected. Test that correct input for expand_string works as expected. ... | 2.958132 | 3 |
setup.py | glibin/natasha | 1 | 3627 | <reponame>glibin/natasha<gh_stars>1-10
from setuptools import setup, find_packages
setup(
name='natasha',
version='0.2.0',
description='Named-entity recognition for russian language',
url='https://github.com/bureaucratic-labs/natasha',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',... | from setuptools import setup, find_packages
setup(
name='natasha',
version='0.2.0',
description='Named-entity recognition for russian language',
url='https://github.com/bureaucratic-labs/natasha',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
classifiers=[
'Development... | none | 1 | 1.084014 | 1 | |
GeneratePassword/generate_password_v2.py | OneScreenfulOfPython/screenfuls | 2 | 3628 | import os, sys
import random
import string
try:
# Make Python2 work like Python3
input = raw_input
except NameError:
# On Python3; already using input
pass
letters = string.ascii_letters
numbers = string.digits
punctuation = string.punctuation
def generate(password_length, at_least_one_letter, at_lea... | import os, sys
import random
import string
try:
# Make Python2 work like Python3
input = raw_input
except NameError:
# On Python3; already using input
pass
letters = string.ascii_letters
numbers = string.digits
punctuation = string.punctuation
def generate(password_length, at_least_one_letter, at_lea... | en | 0.873273 | # Make Python2 work like Python3 # On Python3; already using input Generate a password by include enough random characters to meet the password length restriction. In addition, the user can specify that at least one of the each of the classes of character be used. # # Any combination of characters is valid... | 4.126314 | 4 |
bot/jobs/thorchain_node_jobs.py | block42-blockchain-company/thornode-telegram-bot | 15 | 3629 | <reponame>block42-blockchain-company/thornode-telegram-bot
from constants.messages import get_node_health_warning_message, get_node_healthy_again_message
from handlers.chat_helpers import try_message_with_home_menu, try_message_to_all_users
from packaging import version
from service.utils import *
def check_thornode... | from constants.messages import get_node_health_warning_message, get_node_healthy_again_message
from handlers.chat_helpers import try_message_with_home_menu, try_message_to_all_users
from packaging import version
from service.utils import *
def check_thornodes(context):
chat_id = context.job.context['chat_id']
... | en | 0.907683 | # Update data # If not initialized assuming node was healhty. # Check whether node answers. If it doesn't we get an Exception. Check if node is some blocks behind with catch up status Check that Midgard API is ok | 2.158971 | 2 |
hard-gists/7578539/snippet.py | jjhenkel/dockerizeme | 21 | 3630 | from pylab import *
from numpy import *
from numpy.linalg import solve
from scipy.integrate import odeint
from scipy.stats import norm, uniform, beta
from scipy.special import jacobi
a = 0.0
b = 3.0
theta=1.0
sigma=sqrt(theta/(2*(a+b+2)))
tscale = 0.05
invariant_distribution = poly1d( [-1 for x in range(int(a))], ... | from pylab import *
from numpy import *
from numpy.linalg import solve
from scipy.integrate import odeint
from scipy.stats import norm, uniform, beta
from scipy.special import jacobi
a = 0.0
b = 3.0
theta=1.0
sigma=sqrt(theta/(2*(a+b+2)))
tscale = 0.05
invariant_distribution = poly1d( [-1 for x in range(int(a))], ... | en | 0.874571 | x is a poly1d object Takes jacobi coefficients and propagates them | 2.449384 | 2 |
forms.py | lennykioko/Flask-social-network | 1 | 3631 | # forms are not just about display, instead they are more of validation
# wtf forms protect our site against csrf attacks
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, TextAreaField
from wtforms.validators import (DataRequired, Regexp, ValidationError, Email,
Length, EqualTo... | # forms are not just about display, instead they are more of validation
# wtf forms protect our site against csrf attacks
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, TextAreaField
from wtforms.validators import (DataRequired, Regexp, ValidationError, Email,
Length, EqualTo... | en | 0.957709 | # forms are not just about display, instead they are more of validation # wtf forms protect our site against csrf attacks # is the label | 3.336736 | 3 |
pantam_cli/utils/messages.py | flmnt/pantam | 2 | 3632 | <reponame>flmnt/pantam
from sys import stderr, stdout
from enum import Enum
from colored import fg, attr
PANTAM: str = fg("yellow") + attr("bold") + "PANTAM" + attr("reset")
colour_msg = lambda msg, colour: fg(colour) + attr("bold") + msg + attr("reset")
info_msg = lambda msg: colour_msg(msg, "blue")
success_msg = la... | from sys import stderr, stdout
from enum import Enum
from colored import fg, attr
PANTAM: str = fg("yellow") + attr("bold") + "PANTAM" + attr("reset")
colour_msg = lambda msg, colour: fg(colour) + attr("bold") + msg + attr("reset")
info_msg = lambda msg: colour_msg(msg, "blue")
success_msg = lambda msg: colour_msg(ms... | en | 0.689873 | Write message to stdout Write message to stderr The microframework for microservices. Let's build your app... Actions File Message Your application will look like this: %s Happy to proceed? | 2.842866 | 3 |
tests/manage/test_remove_mon_from_cluster.py | zmc/ocs-ci | 0 | 3633 | """
A Testcase to remove mon from
when I/O's are happening.
Polarion-ID- OCS-355
"""
import logging
import pytest
from ocs_ci.ocs import ocp, constants
from ocs_ci.framework.testlib import tier4, ManageTest
from ocs_ci.framework import config
from ocs_ci.ocs.resources import pod
from tests.helpers import run_io_with... | """
A Testcase to remove mon from
when I/O's are happening.
Polarion-ID- OCS-355
"""
import logging
import pytest
from ocs_ci.ocs import ocp, constants
from ocs_ci.framework.testlib import tier4, ManageTest
from ocs_ci.framework import config
from ocs_ci.ocs.resources import pod
from tests.helpers import run_io_with... | en | 0.884672 | A Testcase to remove mon from when I/O's are happening. Polarion-ID- OCS-355 Verify mon pods are in Running state. Returns: bool: True for wait for the resource, False otherwise Runs the I/O on the pool and delete the pool Returns: A thread of I/O To remove mon pod from the cluster after the ... | 2.015433 | 2 |
smartystreets_python_sdk/us_autocomplete_pro/client.py | Caaz/smartystreets-python-sdk | 0 | 3634 | <reponame>Caaz/smartystreets-python-sdk<filename>smartystreets_python_sdk/us_autocomplete_pro/client.py
from smartystreets_python_sdk import Request
from smartystreets_python_sdk.exceptions import SmartyException
from smartystreets_python_sdk.us_autocomplete_pro import Suggestion, geolocation_type
class Client:
d... | from smartystreets_python_sdk import Request
from smartystreets_python_sdk.exceptions import SmartyException
from smartystreets_python_sdk.us_autocomplete_pro import Suggestion, geolocation_type
class Client:
def __init__(self, sender, serializer):
"""
It is recommended to instantiate this class u... | en | 0.637536 | It is recommended to instantiate this class using ClientBuilder.build_us_autocomplete_pro_api_client() Sends a Lookup object to the US Autocomplete Pro API and stores the result in the Lookup's result field. | 2.282247 | 2 |
mssqlvc.py | Saritasa/mssqlvc | 2 | 3635 | <reponame>Saritasa/mssqlvc<filename>mssqlvc.py
# -*- coding: utf-8 -*-
"""
mssqlvc
~~~~~~~
Database version control utility for Microsoft SQL Server. See README.md for more information.
Licensed under the BSD license. See LICENSE file in the project root for full license information.
"""
import argpa... | # -*- coding: utf-8 -*-
"""
mssqlvc
~~~~~~~
Database version control utility for Microsoft SQL Server. See README.md for more information.
Licensed under the BSD license. See LICENSE file in the project root for full license information.
"""
import argparse
import datetime
import io
import logging
im... | en | 0.677073 | # -*- coding: utf-8 -*- mssqlvc ~~~~~~~ Database version control utility for Microsoft SQL Server. See README.md for more information. Licensed under the BSD license. See LICENSE file in the project root for full license information. SQL Server patch migration class. Initialize instance with connection an... | 1.71986 | 2 |
lib/python3.6/site-packages/statsmodels/iolib/tests/test_table_econpy.py | KshitizSharmaV/Quant_Platform_Python | 1 | 3636 | '''
Unit tests table.py.
:see: http://docs.python.org/lib/minimal-example.html for an intro to unittest
:see: http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html
:see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292
'''
from __future__ import absolute_import
from statsmodel... | '''
Unit tests table.py.
:see: http://docs.python.org/lib/minimal-example.html for an intro to unittest
:see: http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html
:see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292
'''
from __future__ import absolute_import
from statsmodel... | en | 0.4427 | Unit tests table.py. :see: http://docs.python.org/lib/minimal-example.html for an intro to unittest :see: http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html :see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292 #test1header = ('header1\nheader1a', 'header2\nheader2a') # Li... | 2.577466 | 3 |
homeassistant/components/todoist/types.py | MrDelik/core | 30,023 | 3637 | <gh_stars>1000+
"""Types for the Todoist component."""
from __future__ import annotations
from typing import TypedDict
class DueDate(TypedDict):
"""Dict representing a due date in a todoist api response."""
date: str
is_recurring: bool
lang: str
string: str
timezone: str | None
| """Types for the Todoist component."""
from __future__ import annotations
from typing import TypedDict
class DueDate(TypedDict):
"""Dict representing a due date in a todoist api response."""
date: str
is_recurring: bool
lang: str
string: str
timezone: str | None | en | 0.686993 | Types for the Todoist component. Dict representing a due date in a todoist api response. | 2.27327 | 2 |
src/c/c_pyzstd.py | corneliusroemer/pyzstd | 29 | 3638 | <filename>src/c/c_pyzstd.py
from collections import namedtuple
from enum import IntEnum
from ._zstd import *
from . import _zstd
__all__ = (# From this file
'compressionLevel_values', 'get_frame_info',
'CParameter', 'DParameter', 'Strategy',
# From _zstd
'ZstdCompressor', '... | <filename>src/c/c_pyzstd.py
from collections import namedtuple
from enum import IntEnum
from ._zstd import *
from . import _zstd
__all__ = (# From this file
'compressionLevel_values', 'get_frame_info',
'CParameter', 'DParameter', 'Strategy',
# From _zstd
'ZstdCompressor', '... | en | 0.786898 | # From this file # From _zstd # Used in __init__.py # compressionLevel_values Get zstd frame infomation from a frame header. Argument frame_buffer: A bytes-like object. It should starts from the beginning of a frame, and needs to include at least the frame header (6 to 18 by... | 2.123427 | 2 |
test/unit/data/model/mapping/common.py | quacksawbones/galaxy-1 | 1,085 | 3639 | from abc import ABC, abstractmethod
from contextlib import contextmanager
from uuid import uuid4
import pytest
from sqlalchemy import (
delete,
select,
UniqueConstraint,
)
class AbstractBaseTest(ABC):
@pytest.fixture
def cls_(self):
"""
Return class under test.
Assumptions... | from abc import ABC, abstractmethod
from contextlib import contextmanager
from uuid import uuid4
import pytest
from sqlalchemy import (
delete,
select,
UniqueConstraint,
)
class AbstractBaseTest(ABC):
@pytest.fixture
def cls_(self):
"""
Return class under test.
Assumptions... | en | 0.87022 | Return class under test. Assumptions: if the class under test is Foo, then the class grouping the tests should be a subclass of BaseTest, named TestFoo. Use the session to store obj in database; delete from database on exit, bypassing the session. If obj does not have an id field, a SQLAlchemy WHER... | 2.838731 | 3 |
django_events/users/management/commands/create_default_su.py | chrisBrookes93/django-events-management | 0 | 3640 | <reponame>chrisBrookes93/django-events-management
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
class Command(BaseCommand):
help = "Creates a default super user if one doesn't already exist. " \
"This is designed to be used in the docker-compos... | from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
class Command(BaseCommand):
help = "Creates a default super user if one doesn't already exist. " \
"This is designed to be used in the docker-compose.yml to create an initial super user on deploymen... | en | 0.169312 | Checks whether any super users exist and creates a default one if not
:param args: Unused
:param kwargs: Unused | 2.583592 | 3 |
antlir/bzl/image_layer.bzl | zeroxoneb/antlir | 28 | 3641 | <gh_stars>10-100
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
An `image.layer` is a set of `feature` with some additional parameters. Its
purpose to materialize those `feature`s as a... | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
An `image.layer` is a set of `feature` with some additional parameters. Its
purpose to materialize those `feature`s as a btrfs subvolume ... | en | 0.888537 | # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. An `image.layer` is a set of `feature` with some additional parameters. Its purpose to materialize those `feature`s as a btrfs subvolume in th... | 2.080343 | 2 |
python/testData/debug/test_ignore_lib.py | jnthn/intellij-community | 2 | 3642 | from calendar import setfirstweekday
stopped_in_user_file = True
setfirstweekday(15) | from calendar import setfirstweekday
stopped_in_user_file = True
setfirstweekday(15) | none | 1 | 1.300754 | 1 | |
promt_tr/__main__.py | ffreemt/promt-tr-free | 0 | 3643 | <filename>promt_tr/__main__.py
''' __main__, to run:
python -m promt_tr
'''
import sys
from random import randint
from promt_tr import promt_tr, LANG_CODES
# pragma: no cover
def main():
'''main'''
from_lang = 'auto'
to_lang = 'zh'
text = 'test ' + str(randint(0, 10000))
if not sys.argv[1:]:
... | <filename>promt_tr/__main__.py
''' __main__, to run:
python -m promt_tr
'''
import sys
from random import randint
from promt_tr import promt_tr, LANG_CODES
# pragma: no cover
def main():
'''main'''
from_lang = 'auto'
to_lang = 'zh'
text = 'test ' + str(randint(0, 10000))
if not sys.argv[1:]:
... | en | 0.534569 | __main__, to run: python -m promt_tr # pragma: no cover main | 3.295281 | 3 |
src/features/v3/proc_v3_n1_calc_distance.py | askoki/nfl_dpi_prediction | 0 | 3644 | import os
import sys
import pandas as pd
from datetime import datetime
from settings import RAW_DATA_DIR, DataV3, DATA_V3_SUBVERSION
from src.features.helpers.processing import add_missing_timestamp_values
from src.features.helpers.processing_v3 import get_closest_players, get_players_and_ball_indices, calculate_distan... | import os
import sys
import pandas as pd
from datetime import datetime
from settings import RAW_DATA_DIR, DataV3, DATA_V3_SUBVERSION
from src.features.helpers.processing import add_missing_timestamp_values
from src.features.helpers.processing_v3 import get_closest_players, get_players_and_ball_indices, calculate_distan... | en | 0.814583 | # Remove all events without 'pass_forward' # if group does not contain pass forward, drop it # remove all values before 'pass_forward' # convert dataframe into series # remove ball # ball direction and orientation are NaN | 2.519039 | 3 |
annotate-preprocessed.py | Rajpratik71/devel-scripts | 0 | 3645 | #!/usr/bin/python
"""Annotates -E preprocessed source input with line numbers.
Read std input, then annotate each line with line number based on previous
expanded line directives from -E output. Useful in the context of compiler
debugging.
"""
import getopt
import os
import re
import sys
import script_utils as u
... | #!/usr/bin/python
"""Annotates -E preprocessed source input with line numbers.
Read std input, then annotate each line with line number based on previous
expanded line directives from -E output. Useful in the context of compiler
debugging.
"""
import getopt
import os
import re
import sys
import script_utils as u
... | en | 0.697782 | #!/usr/bin/python Annotates -E preprocessed source input with line numbers. Read std input, then annotate each line with line number based on previous expanded line directives from -E output. Useful in the context of compiler debugging. Print usage and exit. \ usage: %s [options] < input > output options: ... | 2.976966 | 3 |
pages/lstm.py | tekeburak/dam-occupancy-model | 8 | 3646 | import streamlit as st
import tensorflow as tf
import numpy
from utils.get_owm_data import get_open_weather_map_data
from utils.get_date import get_date_list_for_gmt
import plotly.graph_objects as go
from plotly import tools
import plotly.offline as py
import plotly.express as px
def app():
st.title("LSTM Model")
... | import streamlit as st
import tensorflow as tf
import numpy
from utils.get_owm_data import get_open_weather_map_data
from utils.get_date import get_date_list_for_gmt
import plotly.graph_objects as go
from plotly import tools
import plotly.offline as py
import plotly.express as px
def app():
st.title("LSTM Model")
... | en | 0.929082 | <p style='text-align: justify;'>LSTM networks are an extension of recurrent neural networks (RNNs) mainly introduced to handle situations where RNNs fail. It has been so designed that thevanishing gradient problem is almost completely removed, while the training model is left unaltered. Long-time lags in certain proble... | 3.153618 | 3 |
fst_web/demo_settings.py | kamidev/autobuild_fst | 0 | 3647 | # -*- coding: utf-8 -*-
import os
ROOT = os.path.abspath(os.path.dirname(__file__))
path = lambda *args: os.path.join(ROOT, *args)
""" Template for local settings of the FST webservice (fst_web)
Please edit this file and replace all generic values with values suitable to
your particular installation.
"""
# NOTE! Al... | # -*- coding: utf-8 -*-
import os
ROOT = os.path.abspath(os.path.dirname(__file__))
path = lambda *args: os.path.join(ROOT, *args)
""" Template for local settings of the FST webservice (fst_web)
Please edit this file and replace all generic values with values suitable to
your particular installation.
"""
# NOTE! Al... | en | 0.696988 | # -*- coding: utf-8 -*- Template for local settings of the FST webservice (fst_web) Please edit this file and replace all generic values with values suitable to your particular installation. # NOTE! Always set this to False before deploying # NOTE! Before deploying on a public, uncomment ALLOWED_HOSTS # and add IP add... | 1.741591 | 2 |
BookingScraper-joao_v2/BookingScraper/airbnb.py | joaocamargo/estudos-python | 1 | 3648 | <gh_stars>1-10
#! /usr/bin/env python3.6
import argparse
import argcomplete
from argcomplete.completers import ChoicesCompleter
from argcomplete.completers import EnvironCompleter
import requests
from bthread import BookingThread
from bs4 import BeautifulSoup
from file_writer import FileWriter
hotels = []
def get_co... | #! /usr/bin/env python3.6
import argparse
import argcomplete
from argcomplete.completers import ChoicesCompleter
from argcomplete.completers import EnvironCompleter
import requests
from bthread import BookingThread
from bs4 import BeautifulSoup
from file_writer import FileWriter
hotels = []
def get_countries():
... | en | 0.266922 | #! /usr/bin/env python3.6 Make request to airbnb page and parse html :param offset: :return: html page #print("ho.find('a', {'class': 'jq_tooltip'})") #print(ho.find('a', {'class': 'jq_tooltip'})) #name = ho.find('a', {'class': 'jq_tooltip'})['data-title'] #print(ho.find('span', {'class': 'sr-hotel__name'})) # ... | 2.647787 | 3 |
main.py | valurhrafn/chromium-sync | 4 | 3649 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | en | 0.599617 | #!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o... | 2.339589 | 2 |
comet/service/subscriber.py | dneise/Comet | 15 | 3650 | # Comet VOEvent Broker.
from twisted.application.internet import ClientService
from comet.protocol.subscriber import VOEventSubscriberFactory
__all__ = ["makeSubscriberService"]
def makeSubscriberService(endpoint, local_ivo, validators, handlers, filters):
"""Create a reconnecting VOEvent subscriber service.
... | # Comet VOEvent Broker.
from twisted.application.internet import ClientService
from comet.protocol.subscriber import VOEventSubscriberFactory
__all__ = ["makeSubscriberService"]
def makeSubscriberService(endpoint, local_ivo, validators, handlers, filters):
"""Create a reconnecting VOEvent subscriber service.
... | en | 0.749076 | # Comet VOEvent Broker. Create a reconnecting VOEvent subscriber service. Parameters ---------- endpoint : implements `twisted.internet.interfaces.IStreamClientEndpoint` The endpoint to which the service will connect. local_ivo : `str` or `None` IVOA identifier for the subscriber. v... | 2.260204 | 2 |
scripts/master/cros_try_job_git.py | bopopescu/build | 0 | 3651 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import json
import os
import re
import shutil
import zlib
from StringIO import StringIO
try:
# Create a block to work around evil sys.m... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import json
import os
import re
import shutil
import zlib
from StringIO import StringIO
try:
# Create a block to work around evil sys.m... | en | 0.825942 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Create a block to work around evil sys.modules manipulation in # email/__init__.py that triggers pylint false positives. # pylint: disable=E0611,F0401 #... | 1.734191 | 2 |
Medium/515.py | Hellofafar/Leetcode | 6 | 3652 | # ------------------------------
# 515. Find Largest Value in Each Tree Row
#
# Description:
# You need to find the largest value in each row of a binary tree.
# Example:
# Input:
# 1
# / \
# 3 2
# / \ \
# 5 3 9
# Output: [1, 3, 9]
#
# Version: 1.0
# 12/22/18 by Jia... | # ------------------------------
# 515. Find Largest Value in Each Tree Row
#
# Description:
# You need to find the largest value in each row of a binary tree.
# Example:
# Input:
# 1
# / \
# 3 2
# / \ \
# 5 3 9
# Output: [1, 3, 9]
#
# Version: 1.0
# 12/22/18 by Jia... | en | 0.579365 | # ------------------------------ # 515. Find Largest Value in Each Tree Row # # Description: # You need to find the largest value in each row of a binary tree. # Example: # Input: # 1 # / \ # 3 2 # / \ \ # 5 3 9 # Output: [1, 3, 9] # # Version: 1.0 # 12/22/18 by Jianfa # ... | 4.225772 | 4 |
opsmop/meta/docs/exparser.py | lachmanfrantisek/opsmop | 0 | 3653 | # Copyright 2018 <NAME> LLC, <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | # Copyright 2018 <NAME> LLC, <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | en | 0.836073 | # Copyright 2018 <NAME> LLC, <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ... | 2.876365 | 3 |
pylox/TokenType.py | sheunl/Compiler_Tests | 0 | 3654 | from enum import Enum
class T(Enum):
#single character Tokens
LEFT_PAREN =1
RIGHT_PAREN =2
LEFT_BRACE = 3
RIGHT_BRACE = 4
COMMA = 5
DOT = 6
MINUS = 7
PLUS = 8
SEMICOLON = 9
SLASH = 10
STAR = 11
#one or two character tokens
BANG = 12
BANG_EQUAL = 13
EQ... | from enum import Enum
class T(Enum):
#single character Tokens
LEFT_PAREN =1
RIGHT_PAREN =2
LEFT_BRACE = 3
RIGHT_BRACE = 4
COMMA = 5
DOT = 6
MINUS = 7
PLUS = 8
SEMICOLON = 9
SLASH = 10
STAR = 11
#one or two character tokens
BANG = 12
BANG_EQUAL = 13
EQ... | en | 0.617278 | #single character Tokens #one or two character tokens #Literals #keywords | 3.207874 | 3 |
src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/framework/framework_add.py | dios-game/dios-cocos | 1 | 3655 | <reponame>dios-game/dios-cocos<gh_stars>1-10
import cocos
from MultiLanguage import MultiLanguage
from package.helper import ProjectHelper
class FrameworkAdd(cocos.CCPlugin):
@staticmethod
def plugin_name():
return "add-framework"
@staticmethod
def brief_description():
return MultiL... | import cocos
from MultiLanguage import MultiLanguage
from package.helper import ProjectHelper
class FrameworkAdd(cocos.CCPlugin):
@staticmethod
def plugin_name():
return "add-framework"
@staticmethod
def brief_description():
return MultiLanguage.get_string('FRAMEWORK_ADD_BRIEF')
... | gl | 0.078054 | # parse arguments | 2.468035 | 2 |
src/utils.py | f-grimaldi/explain_ML | 1 | 3656 | from matplotlib import colors
import numpy as np
class SaveOutput:
def __init__(self):
self.outputs = []
def __call__(self, module, module_in, module_out):
self.outputs.append(module_out)
def clear(self):
self.outputs = []
class MidpointNormalize(colors.Normalize):
def __init... | from matplotlib import colors
import numpy as np
class SaveOutput:
def __init__(self):
self.outputs = []
def __call__(self, module, module_in, module_out):
self.outputs.append(module_out)
def clear(self):
self.outputs = []
class MidpointNormalize(colors.Normalize):
def __init... | en | 0.650457 | # I'm ignoring masked values and all kinds of edge cases to make a # simple example... | 2.710629 | 3 |
lib/two/mongomgr.py | erkyrath/tworld | 38 | 3657 | <reponame>erkyrath/tworld
"""
Manage the connection to the MongoDB server.
"""
import tornado.gen
import tornado.ioloop
import motor
class MongoMgr(object):
def __init__(self, app):
# Keep a link to the owning application.
self.app = app
self.log = self.app.log
# This wil... | """
Manage the connection to the MongoDB server.
"""
import tornado.gen
import tornado.ioloop
import motor
class MongoMgr(object):
def __init__(self, app):
# Keep a link to the owning application.
self.app = app
self.log = self.app.log
# This will be the Motor (MongoDB) c... | en | 0.817455 | Manage the connection to the MongoDB server. # Keep a link to the owning application. # This will be the Motor (MongoDB) connection. We'll open it in the # first monitor_mongo_status call. # true if self.mongo exists and is open # true while monitor_mongo_status runs # We also manage self.app.mongodb, a MotorDatabase. ... | 2.874477 | 3 |
code/examples/example_binomial_and_log_normal_abtest.py | hugopibernat/BayesianABTestAnalysis | 0 | 3658 | #################################################
####### Author: <NAME> #######
####### Contact: <EMAIL> #######
####### Date: April 2014 #######
#################################################
from bayesianABTest import sampleSuccessRateForBinomial, sampleMeanForLogNormal, probabili... | #################################################
####### Author: <NAME> #######
####### Contact: <EMAIL> #######
####### Date: April 2014 #######
#################################################
from bayesianABTest import sampleSuccessRateForBinomial, sampleMeanForLogNormal, probabili... | de | 0.497759 | ################################################# ####### Author: <NAME> ####### ####### Contact: <EMAIL> ####### ####### Date: April 2014 ####### ################################################# # Generate Log-Normal data # Plus some zeros # Modeling conversions with a binomial variable... | 2.210689 | 2 |
tests/models/test_documents.py | airslate-oss/python-airslate | 3 | 3659 | <filename>tests/models/test_documents.py
# This file is part of the airslate.
#
# Copyright (c) 2021 airSlate, Inc.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
from airslate.models.documents import UpdateFields
from airslate.entities.fi... | <filename>tests/models/test_documents.py
# This file is part of the airslate.
#
# Copyright (c) 2021 airSlate, Inc.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
from airslate.models.documents import UpdateFields
from airslate.entities.fi... | en | 0.948323 | # This file is part of the airslate. # # Copyright (c) 2021 airSlate, Inc. # # For the full copyright and license information, please view # the LICENSE file that was distributed with this source code. | 2.090252 | 2 |
sim/dynamicobject.py | rseed42/labyrinth | 0 | 3660 | class DynamicObject(object):
def __init__(self, name, id_):
self.name = name
self.id = id_
| class DynamicObject(object):
def __init__(self, name, id_):
self.name = name
self.id = id_
| none | 1 | 3.049785 | 3 | |
app/main.py | meysam81/sheypoor | 0 | 3661 | <reponame>meysam81/sheypoor
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app import api
from app.core.config import config
app = FastAPI(title="Sheypoor")
# Set all CORS enabled origins
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,... | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app import api
from app.core.config import config
app = FastAPI(title="Sheypoor")
# Set all CORS enabled origins
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
... | en | 0.18489 | # Set all CORS enabled origins | 1.804277 | 2 |
cdnu/ccds.py | Indy2222/mbg-codon-usage | 0 | 3662 | <filename>cdnu/ccds.py
from typing import List, NamedTuple
CCDS_FILE = 'CCDS.current.txt'
CHROMOSOMES = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22',
'X', 'Y')
class CdsPos(NamedTuple):
ccds_id: str
i... | <filename>cdnu/ccds.py
from typing import List, NamedTuple
CCDS_FILE = 'CCDS.current.txt'
CHROMOSOMES = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22',
'X', 'Y')
class CdsPos(NamedTuple):
ccds_id: str
i... | en | 0.906415 | 2-tuples with start (inclusive) and stop indexes (exclusive) in reference genome. Whole CDS can be constructed as concatenation of the sub-sequences. Molecule name, see :const:`CHROMOSOMES` Load file with CDS locations within GRCh38 genome as a list of :class:`CdsPos`. # Skip empty lines # Skip comments # C... | 3.001533 | 3 |
test/test_resolve_errors.py | ITMO-NSS-team/GEFEST | 12 | 3663 | import pytest
from copy import deepcopy
from gefest.core.structure.point import Point
from gefest.core.structure.polygon import Polygon
from gefest.core.structure.structure import Structure
from gefest.core.algs.postproc.resolve_errors import *
from gefest.core.algs.geom.validation import *
# marking length and width... | import pytest
from copy import deepcopy
from gefest.core.structure.point import Point
from gefest.core.structure.polygon import Polygon
from gefest.core.structure.structure import Structure
from gefest.core.algs.postproc.resolve_errors import *
from gefest.core.algs.geom.validation import *
# marking length and width... | en | 0.742613 | # marking length and width for testing polygon # creating a testing polygons via corner points | 2.190065 | 2 |
tests/mocks.py | davla/i3-live-tree | 1 | 3664 | from unittest.mock import MagicMock, Mock
from i3ipc.aio import Con
import i3_live_tree.tree_serializer # noqa: F401
class MockConSerializer(Mock, Con):
"""Mock a generic i3ipc.aio.Con for serialization purposes
This Mock is meant to ease testing of i3ipc.aio.Con serialization methods,
which are mokey... | from unittest.mock import MagicMock, Mock
from i3ipc.aio import Con
import i3_live_tree.tree_serializer # noqa: F401
class MockConSerializer(Mock, Con):
"""Mock a generic i3ipc.aio.Con for serialization purposes
This Mock is meant to ease testing of i3ipc.aio.Con serialization methods,
which are mokey... | en | 0.871293 | # noqa: F401 Mock a generic i3ipc.aio.Con for serialization purposes This Mock is meant to ease testing of i3ipc.aio.Con serialization methods, which are mokey patched in i3_live_tree.tree_serializer. In order to achieve this, the mock inherits all the method implementations of i3ipc.aio.Con, most impo... | 2.88636 | 3 |
hvac/api/secrets_engines/gcp.py | nested-tech/hvac | 0 | 3665 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Gcp methods module."""
from hvac import exceptions
from hvac.api.vault_api_base import VaultApiBase
from hvac.constants.gcp import DEFAULT_MOUNT_POINT, ALLOWED_CREDS_ENDPOINTS
class Gcp(VaultApiBase):
def generate_credentials(self, roleset, endpoint='key', mount_p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Gcp methods module."""
from hvac import exceptions
from hvac.api.vault_api_base import VaultApiBase
from hvac.constants.gcp import DEFAULT_MOUNT_POINT, ALLOWED_CREDS_ENDPOINTS
class Gcp(VaultApiBase):
def generate_credentials(self, roleset, endpoint='key', mount_p... | en | 0.281289 | #!/usr/bin/env python # -*- coding: utf-8 -*- Gcp methods module. | 2.386923 | 2 |
ypricemagic/uniswap.py | poolpitako/ypricemagic | 0 | 3666 | import token
from tokenize import tokenize
from brownie import Contract, chain
from brownie.exceptions import ContractNotFound
from cachetools.func import ttl_cache
from .utils.cache import memory
from .utils.multicall2 import fetch_multicall
from .interfaces.ERC20 import ERC20ABI
import ypricemagic.magic
import yprice... | import token
from tokenize import tokenize
from brownie import Contract, chain
from brownie.exceptions import ContractNotFound
from cachetools.func import ttl_cache
from .utils.cache import memory
from .utils.multicall2 import fetch_multicall
from .interfaces.ERC20 import ERC20ABI
import ypricemagic.magic
import yprice... | en | 0.770189 | # NOTE: If this is failing to pull a price for a token you need, it's likely because that token requires a special swap path. # Please add a viable swap path below to fetch price data successfully. #project.load() Calculate a price based on Uniswap Router quote for selling one `token_in`. Always uses intermed... | 1.957928 | 2 |
configs/configuration_textrnn.py | haodingkui/semeval2020-task5-subtask1 | 2 | 3667 | """ TextRNN model configuration """
class TextRNNConfig(object):
def __init__(
self,
vocab_size=30000,
pretrained_embedding=None,
embedding_matrix=None,
embedding_dim=300,
embedding_dropout=0.3,
lstm_hidden_size=128,
output_dim=1,
**kwargs
... | """ TextRNN model configuration """
class TextRNNConfig(object):
def __init__(
self,
vocab_size=30000,
pretrained_embedding=None,
embedding_matrix=None,
embedding_dim=300,
embedding_dropout=0.3,
lstm_hidden_size=128,
output_dim=1,
**kwargs
... | en | 0.471983 | TextRNN model configuration | 2.81591 | 3 |
settings/debug_members.py | akorzunin/telegram_auction_bot | 0 | 3668 | <gh_stars>0
DEBUG_MEMBER_LIST = [
503131177,
] | DEBUG_MEMBER_LIST = [
503131177,
] | none | 1 | 1.099158 | 1 | |
metrics/pointops/pointops_util.py | JiazeWang/SP-GAN | 73 | 3669 | from typing import Tuple
import torch
from torch.autograd import Function
import torch.nn as nn
from metrics.pointops import pointops_cuda
import numpy as np
class FurthestSampling(Function):
@staticmethod
def forward(ctx, xyz, m):
"""
input: xyz: (b, n, 3) and n > m, m: int32
outpu... | from typing import Tuple
import torch
from torch.autograd import Function
import torch.nn as nn
from metrics.pointops import pointops_cuda
import numpy as np
class FurthestSampling(Function):
@staticmethod
def forward(ctx, xyz, m):
"""
input: xyz: (b, n, 3) and n > m, m: int32
outpu... | en | 0.58574 | input: xyz: (b, n, 3) and n > m, m: int32 output: idx: (b, m) input: features: (b, c, n), idx : (b, m) tensor output: (b, c, m) Find the three nearest neighbors of unknown in known input: unknown: (b, n, 3), known: (b, m, 3) output: dist2: (b, n, 3) l2 distance to the three nearest neigh... | 2.557499 | 3 |
core/src/zeit/cms/content/caching.py | rickdg/vivi | 5 | 3670 | <reponame>rickdg/vivi
from collections import defaultdict
from logging import getLogger
from operator import itemgetter
from os import environ
from time import time
from zope.cachedescriptors.property import Lazy as cachedproperty
from zeit.cms.content.sources import FEATURE_TOGGLES
from zope.component import getUtilit... | from collections import defaultdict
from logging import getLogger
from operator import itemgetter
from os import environ
from time import time
from zope.cachedescriptors.property import Lazy as cachedproperty
from zeit.cms.content.sources import FEATURE_TOGGLES
from zope.component import getUtility
from zeit.connector.... | none | 1 | 1.88344 | 2 | |
genesis/project.py | genialis/genesis-genapi | 3 | 3671 | <reponame>genialis/genesis-genapi
"""Project"""
from __future__ import absolute_import, division, print_function, unicode_literals
class GenProject(object):
"""Genesais project annotation."""
def __init__(self, data, gencloud):
for field in data:
setattr(self, field, data[field])
... | """Project"""
from __future__ import absolute_import, division, print_function, unicode_literals
class GenProject(object):
"""Genesais project annotation."""
def __init__(self, data, gencloud):
for field in data:
setattr(self, field, data[field])
self.gencloud = gencloud
... | en | 0.480672 | Project Genesais project annotation. # pylint: disable=invalid-name Return a list of data types. Query for Data object annotation. Filter Data object annotation. | 2.650298 | 3 |
account/views.py | KimSoungRyoul/drf_unitteset_study_project | 0 | 3672 | <reponame>KimSoungRyoul/drf_unitteset_study_project<gh_stars>0
# Create your views here.
from django.db.models import QuerySet
from django.utils.decorators import method_decorator
from drf_yasg.utils import swagger_auto_schema
from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenti... | # Create your views here.
from django.db.models import QuerySet
from django.utils.decorators import method_decorator
from drf_yasg.utils import swagger_auto_schema
from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.response import Response
fr... | en | 0.968116 | # Create your views here. | 2.007865 | 2 |
src/front-door/azext_front_door/_validators.py | Mannan2812/azure-cli-extensions | 207 | 3673 | <reponame>Mannan2812/azure-cli-extensions<gh_stars>100-1000
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------... | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | en | 0.506512 | # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------... | 2.081624 | 2 |
mimesis/data/int/development.py | DevAerial/mimesis | 0 | 3674 | <filename>mimesis/data/int/development.py
"""Provides all the data related to the development."""
LICENSES = [
"Apache License, 2.0 (Apache-2.0)",
"The BSD 3-Clause License",
"The BSD 2-Clause License",
"GNU General Public License (GPL)",
"General Public License (LGPL)",
"MIT License (MIT)",
... | <filename>mimesis/data/int/development.py
"""Provides all the data related to the development."""
LICENSES = [
"Apache License, 2.0 (Apache-2.0)",
"The BSD 3-Clause License",
"The BSD 2-Clause License",
"GNU General Public License (GPL)",
"General Public License (LGPL)",
"MIT License (MIT)",
... | en | 0.611499 | Provides all the data related to the development. #", #", #", | 1.509253 | 2 |
docs/mathparse.py | pcmoritz/flow | 16 | 3675 | <filename>docs/mathparse.py
"""
A preliminary attempt at parsing an RST file's math syntax
in order to make math render as inline rather than display
mode. This doesn't work as of yet but might be useful.
It could, however, be not useful if there's a pandoc option
for converting .md to .rst that makes math inline and ... | <filename>docs/mathparse.py
"""
A preliminary attempt at parsing an RST file's math syntax
in order to make math render as inline rather than display
mode. This doesn't work as of yet but might be useful.
It could, however, be not useful if there's a pandoc option
for converting .md to .rst that makes math inline and ... | en | 0.905973 | A preliminary attempt at parsing an RST file's math syntax in order to make math render as inline rather than display mode. This doesn't work as of yet but might be useful. It could, however, be not useful if there's a pandoc option for converting .md to .rst that makes math inline and not display. Keeping it around, ... | 3.006089 | 3 |
lib/layout/primitives.py | tailhook/pyzza | 2 | 3676 | from layout import Shape, Widget
from flash.text.engine import TextBlock, TextElement
@package('layout')
class Poly(Shape):
__slots__ = ('fillcolor', 'sequence')
def __init__(self, name, fillcolor, seq, states):
super().__init__(name, states)
self.fillcolor = fillcolor
self.sequence = s... | from layout import Shape, Widget
from flash.text.engine import TextBlock, TextElement
@package('layout')
class Poly(Shape):
__slots__ = ('fillcolor', 'sequence')
def __init__(self, name, fillcolor, seq, states):
super().__init__(name, states)
self.fillcolor = fillcolor
self.sequence = s... | none | 1 | 2.768518 | 3 | |
tests/testing_server.py | ImportTaste/WebRequest | 0 | 3677 | <gh_stars>0
import traceback
import uuid
import socket
import logging
import os
import base64
import zlib
import gzip
import time
import datetime
from http import cookies
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from threading import Thread
import WebRequest
def capture_expe... | import traceback
import uuid
import socket
import logging
import os
import base64
import zlib
import gzip
import time
import datetime
from http import cookies
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from threading import Thread
import WebRequest
def capture_expected_headers(... | de | 0.433827 | # print("Capturing expected headers:") # print(expected_headers) # So PhantomJS monkeys with accept-encoding headers # Just ignore that particular header, I guess. # Selenium is fucking retarded, and I can't override the user-agent # and other assorted parameters via their API at all. # Process an HTTP GET request and ... | 2.324716 | 2 |
calcgrades.py | qrowsxi/calcgrades | 0 | 3678 | import csv
import math
import numpy as np
import pandas
import scipy.optimize
import sys
import argparse
def ineq_constraint_1(v):
return np.array([vi for vi in v])
def ineq_constraint_2(v):
return np.array([-vi + 30 for vi in v])
class WeightAverage:
def __init__(self, mean, csv):
self.df = ... | import csv
import math
import numpy as np
import pandas
import scipy.optimize
import sys
import argparse
def ineq_constraint_1(v):
return np.array([vi for vi in v])
def ineq_constraint_2(v):
return np.array([-vi + 30 for vi in v])
class WeightAverage:
def __init__(self, mean, csv):
self.df = ... | en | 0.955129 | CalcGrades is an utility which purpose is to compute the minimum grades required to get a certain weight average of the grades over the credits, given the desired output and the grades already owned. | 3.031086 | 3 |
sdk/python/pulumi_google_native/testing/v1/test_matrix.py | AaronFriel/pulumi-google-native | 44 | 3679 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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, Unio... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 _utilities
fro... | en | 0.883553 | # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** The set of arguments for constructing a TestMatrix resource. :param pulumi.Input['EnvironmentMatrixArgs'] environment_matrix: The devices the te... | 1.927035 | 2 |
View/View.py | MoriokaReimen/ConfigHeaderGenerator | 0 | 3680 | import tkinter as tk
import tkinter.messagebox
from Control import Control
class View:
def __init__(self, control : Control.Control):
self.control = control
# Init Window
self.root = tk.Tk()
self.root.title(u"Header File Generator")
self.root.geometry("700x800")
se... | import tkinter as tk
import tkinter.messagebox
from Control import Control
class View:
def __init__(self, control : Control.Control):
self.control = control
# Init Window
self.root = tk.Tk()
self.root.title(u"Header File Generator")
self.root.geometry("700x800")
se... | en | 0.281207 | # Init Window # Config Table # Config Table # Generator Button | 2.852432 | 3 |
tests/bugs/core_3355_test.py | FirebirdSQL/firebird-qa | 1 | 3681 | <filename>tests/bugs/core_3355_test.py
#coding:utf-8
#
# id: bugs.core_3355
# title: Wrong comparsion of DATE and TIMESTAMP if index is used
# decription:
# tracker_id: CORE-3355
# min_versions: ['2.1.5']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, i... | <filename>tests/bugs/core_3355_test.py
#coding:utf-8
#
# id: bugs.core_3355
# title: Wrong comparsion of DATE and TIMESTAMP if index is used
# decription:
# tracker_id: CORE-3355
# min_versions: ['2.1.5']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, i... | en | 0.466088 | #coding:utf-8 # # id: bugs.core_3355 # title: Wrong comparsion of DATE and TIMESTAMP if index is used # decription: # tracker_id: CORE-3355 # min_versions: ['2.1.5'] # versions: 3.0 # qmid: None # version: 3.0 # resources: None create table tdate (id integer not null primary key, val date... | 1.828302 | 2 |
dags/download_decrypt_transfer_files.py | hms-dbmi/bch-pic-sure-airflow-dags | 0 | 3682 | <reponame>hms-dbmi/bch-pic-sure-airflow-dags
"""
@author: anilkdegala
"""
import os
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from datetime import date, timedelta, datetime
from collections import O... | """
@author: anilkdegala
"""
import os
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from datetime import date, timedelta, datetime
from collections import OrderedDict
from scripts.dag_pebbles import ... | en | 0.447082 | @author: anilkdegala | 2.284069 | 2 |
keystone-moon/keystone/endpoint_policy/controllers.py | hashnfv/hashnfv-moon | 0 | 3683 | <reponame>hashnfv/hashnfv-moon<gh_stars>0
# Copyright 2014 IBM Corp.
#
# 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... | # Copyright 2014 IBM Corp.
#
# 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, s... | en | 0.914681 | # Copyright 2014 IBM Corp. # # 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, s... | 1.595752 | 2 |
src/nibetaseries/cli/run.py | ipacheco-uy/NiBetaSeries | 1 | 3684 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -m nibetaser... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -m nibetaser... | en | 0.73719 | #!/usr/bin/env python # -*- coding: utf-8 -*- Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -m nibetaseries`... | 1.641675 | 2 |
custom_components/senz/config_flow.py | astrandb/senz_hass | 2 | 3685 | <gh_stars>1-10
"""Config flow for SENZ WiFi."""
from __future__ import annotations
import logging
from typing import Any
import voluptuous as vol
from homeassistant.components import persistent_notification
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_entry_oauth2_flo... | """Config flow for SENZ WiFi."""
from __future__ import annotations
import logging
from typing import Any
import voluptuous as vol
from homeassistant.components import persistent_notification
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_entry_oauth2_flow
from .const ... | en | 0.778632 | Config flow for SENZ WiFi. Config flow to handle SENZ WiFi OAuth2 authentication. Return logger. Extra data that needs to be appended to the authorize url. Perform reauth upon an API authentication error. Dialog that informs the user that reauth is required. Create an oauth config entry or update existing entry for rea... | 2.402159 | 2 |
astropy_helpers/git_helpers.py | bsipocz/astropy-helpers | 9 | 3686 | <reponame>bsipocz/astropy-helpers
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utilities for retrieving revision information from a project's git repository.
"""
# Do not remove the following comment; it is used by
# astropy_helpers.version_helpers to determine the beginning of the code in
# th... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utilities for retrieving revision information from a project's git repository.
"""
# Do not remove the following comment; it is used by
# astropy_helpers.version_helpers to determine the beginning of the code in
# this module
# BEGIN
import locale
... | en | 0.75045 | # Licensed under a 3-clause BSD style license - see LICENSE.rst Utilities for retrieving revision information from a project's git repository. # Do not remove the following comment; it is used by # astropy_helpers.version_helpers to determine the beginning of the code in # this module # BEGIN # Final fallback Updates t... | 2.217321 | 2 |
src/sot_talos_balance/test/test_feet_admittance.py | imaroger/sot-talos-balance | 0 | 3687 | <reponame>imaroger/sot-talos-balance
'''Test feet admittance control'''
from sot_talos_balance.utils.run_test_utils import run_ft_calibration, run_test, runCommandClient
try:
# Python 2
input = raw_input # noqa
except NameError:
pass
run_test('appli_feet_admittance.py')
run_ft_calibration('robot.ftc')
i... | '''Test feet admittance control'''
from sot_talos_balance.utils.run_test_utils import run_ft_calibration, run_test, runCommandClient
try:
# Python 2
input = raw_input # noqa
except NameError:
pass
run_test('appli_feet_admittance.py')
run_ft_calibration('robot.ftc')
input("Wait before running the test")
... | en | 0.598716 | Test feet admittance control # Python 2 # noqa | 2.252778 | 2 |
tests/test_db.py | davebryson/py-tendermint | 24 | 3688 | <reponame>davebryson/py-tendermint
import os
from tendermint.db import VanillaDB
from tendermint.utils import home_dir
def test_database():
dbfile = home_dir('temp', 'test.db')
db = VanillaDB(dbfile)
db.set(b'dave',b'one')
result = db.get(b'dave')
assert(b'one' == result)
db.set(b'dave',b'tw... | import os
from tendermint.db import VanillaDB
from tendermint.utils import home_dir
def test_database():
dbfile = home_dir('temp', 'test.db')
db = VanillaDB(dbfile)
db.set(b'dave',b'one')
result = db.get(b'dave')
assert(b'one' == result)
db.set(b'dave',b'two')
result = db.get(b'dave')
... | none | 1 | 2.428347 | 2 | |
auth/tests/test_views.py | asb29/Redundant | 0 | 3689 | from django.test import TestCase
from django.test import Client
class RegisterTestCase(TestCase):
def test_register(self):
c = Client()
# on success redirects to /
response = c.post('/accounts/register/', {
'username': 'asdas',
'password1': '<PASSWORD>',
... | from django.test import TestCase
from django.test import Client
class RegisterTestCase(TestCase):
def test_register(self):
c = Client()
# on success redirects to /
response = c.post('/accounts/register/', {
'username': 'asdas',
'password1': '<PASSWORD>',
... | en | 0.904863 | # on success redirects to / # passwords don't match # username is empty # no password # username and password are similar | 2.869279 | 3 |
projects/OneNet/onenet/head.py | iFighting/OneNet | 2 | 3690 | #
# Modified by <NAME>
# Contact: <EMAIL>
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
OneNet Transformer class.
Copy-paste from torch.nn.Transformer with modifications:
* positional encodings are passed in MHattention
* extra LN at the end of encoder is removed
* decoder re... | #
# Modified by <NAME>
# Contact: <EMAIL>
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
OneNet Transformer class.
Copy-paste from torch.nn.Transformer with modifications:
* positional encodings are passed in MHattention
* extra LN at the end of encoder is removed
* decoder re... | en | 0.720754 | # # Modified by <NAME> # Contact: <EMAIL> # # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved OneNet Transformer class. Copy-paste from torch.nn.Transformer with modifications: * positional encodings are passed in MHattention * extra LN at the end of encoder is removed * decoder return... | 2.322492 | 2 |
mermaid/utils.py | HastingsGreer/mermaid | 120 | 3691 | <gh_stars>100-1000
"""Various utility functions.
.. todo::
Reorganize this package in a more meaningful way.
"""
from __future__ import print_function
from __future__ import absolute_import
# from builtins import str
# from builtins import range
import torch
from torch.nn.parameter import Parameter
from torch.aut... | """Various utility functions.
.. todo::
Reorganize this package in a more meaningful way.
"""
from __future__ import print_function
from __future__ import absolute_import
# from builtins import str
# from builtins import range
import torch
from torch.nn.parameter import Parameter
from torch.autograd import Variab... | en | 0.574704 | Various utility functions. .. todo:: Reorganize this package in a more meaningful way. # from builtins import str # from builtins import range Check if any input elements are NaNs. :param x: numpy array :return: True if NaNs are present, False else # nothing to do here, these are already the same file # n... | 2.109133 | 2 |
examples/io/plot_read_evoked.py | fmamashli/mne-python | 3 | 3692 | <filename>examples/io/plot_read_evoked.py
"""
==================================
Reading and writing an evoked file
==================================
This script shows how to read and write evoked datasets.
"""
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from mne import read_evokeds
from mne.datasets impo... | <filename>examples/io/plot_read_evoked.py
"""
==================================
Reading and writing an evoked file
==================================
This script shows how to read and write evoked datasets.
"""
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from mne import read_evokeds
from mne.datasets impo... | en | 0.440877 | ================================== Reading and writing an evoked file ================================== This script shows how to read and write evoked datasets. # Author: <NAME> <<EMAIL>> # # License: BSD (3-clause) # Reading ############################################################################### # Show resul... | 2.805136 | 3 |
source/monkeyPatches/__init__.py | lukaszgo1/nvda | 19 | 3693 | <filename>source/monkeyPatches/__init__.py
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2021 NV Access Limited
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
from . import wxMonkeyPatches
applyWxMonkeyPatches = wxMonkeyPatches.apply
def ... | <filename>source/monkeyPatches/__init__.py
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2021 NV Access Limited
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
from . import wxMonkeyPatches
applyWxMonkeyPatches = wxMonkeyPatches.apply
def ... | en | 0.885293 | # A part of NonVisual Desktop Access (NVDA) # Copyright (C) 2021 NV Access Limited # This file is covered by the GNU General Public License. # See the file COPYING for more details. # Apply several monkey patches to comtypes # F401 - imported but unused: Patches are applied during import # noqa: F401 # Apply patches to... | 1.532666 | 2 |
yt_dlp/extractor/ninenow.py | nxtreaming/yt-dlp | 11 | 3694 | <reponame>nxtreaming/yt-dlp<gh_stars>10-100
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
str_or_none,
try_get,
unified_strdate,
unified_timestamp,
)
class NineNowIE(InfoExtractor):
I... | from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
str_or_none,
try_get,
unified_strdate,
unified_timestamp,
)
class NineNowIE(InfoExtractor):
IE_NAME = '9now.com.au'
_VALID_URL = r'ht... | en | 0.860165 | #]+)' # clip # episode # DRM protected # episode of series | 2.047034 | 2 |
apex/fp16_utils/fused_weight_norm.py | mcarilli/apex | 1 | 3695 | <gh_stars>1-10
import torch
from torch.autograd import Variable
from torch.autograd.function import Function, once_differentiable
import apex_C
def check_contig_cuda(tensors, names):
for tensor, name in zip(tensors, names):
if not tensor.is_contiguous():
raise RuntimeError(name+" with size {} i... | import torch
from torch.autograd import Variable
from torch.autograd.function import Function, once_differentiable
import apex_C
def check_contig_cuda(tensors, names):
for tensor, name in zip(tensors, names):
if not tensor.is_contiguous():
raise RuntimeError(name+" with size {} is not contiguou... | en | 0.7069 | Custom autograd function that implements weight norm, as presented in `<https://arxiv.org/abs/1602.07868>`_, along a tensor's slowest or fastest dimension using fused kernel launches for the forward and backward passes. Accepts fp32 or fp16 input; the output type will match the input type. Within ... | 2.568531 | 3 |
bzt/modules/grinder.py | gerardorf/taurus | 1 | 3696 | """
Module holds all stuff regarding Grinder tool usage
Copyright 2015 BlazeMeter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless require... | """
Module holds all stuff regarding Grinder tool usage
Copyright 2015 BlazeMeter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless require... | en | 0.761572 | Module holds all stuff regarding Grinder tool usage Copyright 2015 BlazeMeter Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by... | 1.566107 | 2 |
test/Fortran/fixture/myfortran_flags.py | moroten/scons | 1,403 | 3697 | <reponame>moroten/scons<gh_stars>1000+
import getopt
import sys
comment = ('#' + sys.argv[1]).encode()
opts, args = getopt.getopt(sys.argv[2:], 'cf:o:xy')
optstring = ''
length = len(comment)
for opt, arg in opts:
if opt == '-o': out = arg
elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
infile =... | import getopt
import sys
comment = ('#' + sys.argv[1]).encode()
opts, args = getopt.getopt(sys.argv[2:], 'cf:o:xy')
optstring = ''
length = len(comment)
for opt, arg in opts:
if opt == '-o': out = arg
elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
infile = open(args[0], 'rb')
outfile = open(out... | none | 1 | 2.730383 | 3 | |
zen_knit/organizer/__init__.py | Zen-Reportz/zen_knit | 30 | 3698 | <gh_stars>10-100
import io
import os
import base64
from pathlib import Path
from nbconvert import filters
from pygments.formatters.latex import LatexFormatter
from zen_knit import formattor
from zen_knit.data_types import ChunkOption, ExecutedData, OrganizedChunk, OrganizedData
from zen_knit.formattor.html_formatter ... | import io
import os
import base64
from pathlib import Path
from nbconvert import filters
from pygments.formatters.latex import LatexFormatter
from zen_knit import formattor
from zen_knit.data_types import ChunkOption, ExecutedData, OrganizedChunk, OrganizedData
from zen_knit.formattor.html_formatter import HTMLFormat... | en | 0.33749 | # Doing nothing here # if "BokehJS" in temp: # t = {"type": "html_data", "str_data": "<script type='text/javascript'>" + temp.encode().decode() + "</script>" } # self.organized_data.chunks.append(OrganizedChunk(**t)) # return True # markdown_file = self.executed_data.global_options.input_file_name.split(".... | 2.103992 | 2 |
qibullet/robot_virtual.py | mcaniot/qibullet | 0 | 3699 | <filename>qibullet/robot_virtual.py
#!/usr/bin/env python
# coding: utf-8
import sys
import pybullet
from qibullet.camera import *
from qibullet.link import Link
from qibullet.joint import Joint
IS_VERSION_PYTHON_3 = sys.version_info[0] >= 3
class RobotVirtual:
"""
Mother class representing a virtual robot
... | <filename>qibullet/robot_virtual.py
#!/usr/bin/env python
# coding: utf-8
import sys
import pybullet
from qibullet.camera import *
from qibullet.link import Link
from qibullet.joint import Joint
IS_VERSION_PYTHON_3 = sys.version_info[0] >= 3
class RobotVirtual:
"""
Mother class representing a virtual robot
... | en | 0.826131 | #!/usr/bin/env python # coding: utf-8 Mother class representing a virtual robot Constructor Parameters: description_file - The file giving the description of the virtual robot. For now, only URDF is handled Loads the robot into a simulation, loads the joints and the links descri... | 2.573526 | 3 |