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 |
|---|---|---|---|---|---|---|---|---|---|---|
module2-sql-for-analysis/cleanSql.py | DAVIDnHANG/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 6623051 | import psycopg2
import sqlite3
#setting up for psycopy2.connect
dbname = 'wbtaflae'
user = 'wbtaflae'
password = ''
host = 'salt.db.elephantsql.com'
rpg_conn = psycopg2.connect( dbname =dbname, user=user, password=password, host=host)
#create the cursor once we established a connection to database server
... | import psycopg2
import sqlite3
#setting up for psycopy2.connect
dbname = 'wbtaflae'
user = 'wbtaflae'
password = ''
host = 'salt.db.elephantsql.com'
rpg_conn = psycopg2.connect( dbname =dbname, user=user, password=password, host=host)
#create the cursor once we established a connection to database server
... | en | 0.50463 | #setting up for psycopy2.connect #create the cursor once we established a connection to database server #once the cursor is established, we can now execute quires command #create_character_table_two = """ #CREATE TABLE charactercreator_character_inventory_web ( #character_id SERIAL PRIMARY KEY, #name VARCHAR(30), #item... | 3.408939 | 3 |
Implementation/models/ShoppingCart.py | AchuthaVVyas/259902_Ltts_StepIN- | 0 | 6623052 | from models.Item import Item
class ShoppingCart:
def __init__(self):
self.items = []
def addToCart(self, item):
self.items.append(item)
def removeFromCart(self, itemIndex):
self.items.pop(itemIndex)
def getTotalPrice(self):
totalPrice = 0
for item in self.ite... | from models.Item import Item
class ShoppingCart:
def __init__(self):
self.items = []
def addToCart(self, item):
self.items.append(item)
def removeFromCart(self, itemIndex):
self.items.pop(itemIndex)
def getTotalPrice(self):
totalPrice = 0
for item in self.ite... | none | 1 | 3.078922 | 3 | |
Working1/Init.py | fovtran/PyGame_samples | 0 | 6623053 | <gh_stars>0
# -*- coding: utf-8 -*-
from AllImports import *
w = 1200
h = 600
FPS = 10
def SetScreen():
global screen
pygame.init ()
pygame.font.init()
info = pygame.display.Info()
print(info)
flags = pygame.OPENGL | pygame.DOUBLEBUF | pygame.HWSURFACE | pygame.RESIZABLE
screen = pygame.display.set_mode((w,h),... | # -*- coding: utf-8 -*-
from AllImports import *
w = 1200
h = 600
FPS = 10
def SetScreen():
global screen
pygame.init ()
pygame.font.init()
info = pygame.display.Info()
print(info)
flags = pygame.OPENGL | pygame.DOUBLEBUF | pygame.HWSURFACE | pygame.RESIZABLE
screen = pygame.display.set_mode((w,h), flags, 32, ... | en | 0.369955 | # -*- coding: utf-8 -*- #glEnable(GL_NORMALIZE) #glEnable(GL_BLEND); #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) #glEnable(GL_NORMALIZE) | 2.389301 | 2 |
stream/generate/create.py | sanjeevkanabargi/python | 0 | 6623054 | import random
import json
from datetime import datetime, timedelta
import csv
timestamp = datetime.now() + timedelta(days=-3)
def randomIP():
arrVal = ["127.1.1.0","192.168.1.1","192.168.0.1","192.168.3.1","192.168.8.1","192.168.100.1","10.0.0.138"]
return arrVal[random.randint(0,len(arrVal)-1)]
def random... | import random
import json
from datetime import datetime, timedelta
import csv
timestamp = datetime.now() + timedelta(days=-3)
def randomIP():
arrVal = ["127.1.1.0","192.168.1.1","192.168.0.1","192.168.3.1","192.168.8.1","192.168.100.1","10.0.0.138"]
return arrVal[random.randint(0,len(arrVal)-1)]
def random... | en | 0.311362 | #print("returning : "+arrVal[random.randint(0,len(arrVal)-1)]) #print("thje date :"+str(timestamp)) #data['dst_ip_location'] = getRandomIPLoc() #data['src_ip_location'] = getRandomIPLoc() #Create JSON message from above variables. #create CSV files from above message. #print(toPrint) #message = createRandomData() #prin... | 2.679731 | 3 |
mytest.py | djun100/aircv | 0 | 6623055 | <reponame>djun100/aircv
import aircv as ac
imsrc = ac.imread('tests/testdata/g18/screen_big.png') # 原始图像
imsch = ac.imread('tests/testdata/g18/task.png') # 带查找的部分
print((ac.find_sift(imsrc, imsch)))
| import aircv as ac
imsrc = ac.imread('tests/testdata/g18/screen_big.png') # 原始图像
imsch = ac.imread('tests/testdata/g18/task.png') # 带查找的部分
print((ac.find_sift(imsrc, imsch))) | zh | 0.993423 | # 原始图像 # 带查找的部分 | 2.200836 | 2 |
test/win/gyptest-cl-compile-as-winrt.py | chlorm-forks/gyp | 2,151 | 6623056 | # Copyright (c) 2016 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import TestGyp
import os
import sys
if (sys.platform == 'win32' and
int(os.environ.get('GYP_MSVS_VERSION', 0)) >= 2015):
test = TestGyp.TestGyp(formats=['m... | # Copyright (c) 2016 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import TestGyp
import os
import sys
if (sys.platform == 'win32' and
int(os.environ.get('GYP_MSVS_VERSION', 0)) >= 2015):
test = TestGyp.TestGyp(formats=['m... | en | 0.921492 | # Copyright (c) 2016 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. | 1.82641 | 2 |
igcommit/utils.py | hasegeli/igcommit | 189 | 6623057 | <gh_stars>100-1000
"""igcommit - Utility functions
Copyright (c) 2021 InnoGames GmbH
Portions Copyright (c) 2021 <NAME>
"""
from os import X_OK, access, environ
def get_exe_path(exe):
"""Traverse the PATH to find where the executable is
This should behave similar to the shell built-in "which".
"""
... | """igcommit - Utility functions
Copyright (c) 2021 InnoGames GmbH
Portions Copyright (c) 2021 <NAME>
"""
from os import X_OK, access, environ
def get_exe_path(exe):
"""Traverse the PATH to find where the executable is
This should behave similar to the shell built-in "which".
"""
for dir_path in env... | en | 0.940195 | igcommit - Utility functions Copyright (c) 2021 InnoGames GmbH Portions Copyright (c) 2021 <NAME> Traverse the PATH to find where the executable is This should behave similar to the shell built-in "which". Iterate with buffering This is a utility function that's useful for asynchronous processing. It buf... | 3.506577 | 4 |
setup.py | jgoodknight/spectroscopy | 6 | 6623058 | <reponame>jgoodknight/spectroscopy<gh_stars>1-10
#!/usr/bin/env python
from distutils.core import setup
with open("README.md", 'r') as f:
long_description = f.read()
setup(name='spectroscopy',
version='0.10',
description='Spectroscopy of systems with explicit vibrational degrees of Freedom',
au... | #!/usr/bin/env python
from distutils.core import setup
with open("README.md", 'r') as f:
long_description = f.read()
setup(name='spectroscopy',
version='0.10',
description='Spectroscopy of systems with explicit vibrational degrees of Freedom',
author='<NAME>',
author_email='<EMAIL>',
... | ru | 0.095953 | #!/usr/bin/env python #,install_requires=['numpy', 'scipy', 'matplotlib'] | 1.281402 | 1 |
settings.py | bgmnbear/RetroMusicPlayer | 0 | 6623059 | MUSIC_PATH = r'../music/'
LYRIC_PATH = r'../lyric/'
| MUSIC_PATH = r'../music/'
LYRIC_PATH = r'../lyric/'
| none | 1 | 1.143017 | 1 | |
pyeccodes/defs/mars/grib_gfas_gsd_def.py | ecmwf/pyeccodes | 7 | 6623060 | import pyeccodes.accessors as _
def load(h):
h.unalias('mars.levtype')
h.unalias('mars.levelist')
h.unalias('mars.channel')
h.unalias('mars.step')
| import pyeccodes.accessors as _
def load(h):
h.unalias('mars.levtype')
h.unalias('mars.levelist')
h.unalias('mars.channel')
h.unalias('mars.step')
| none | 1 | 1.601236 | 2 | |
test/test_apisearch.py | WallaceLiu/distributed-realtime-capfaiss | 0 | 6623061 | import unittest
import requests
import json
from core_test.base.test_base import http, headers, NpEncoder
import numpy as np
from core.utils.io_utils import write
class SearchApiTest(unittest.TestCase):
def test(self):
url = '%s/%s' % (http, 'rc/search')
d = 100
nb = 2000
np.rand... | import unittest
import requests
import json
from core_test.base.test_base import http, headers, NpEncoder
import numpy as np
from core.utils.io_utils import write
class SearchApiTest(unittest.TestCase):
def test(self):
url = '%s/%s' % (http, 'rc/search')
d = 100
nb = 2000
np.rand... | en | 0.256857 | # r = requests.post(url, data=data, headers=headers) # print(""" # # url...%s # content...%s # # """ % (url, r.content)) | 2.777094 | 3 |
UI.py | privacyrespected/Alpha | 0 | 6623062 | #This program is used for linkage of the UI to the backend algorithm such as the live computer stats shown on the left menu
from platform import platform
import eel
import psutil
import sys
import platform
from frontend_command import Pcommand
eel.init("web")
@eel.expose
def checkram():
memory_info=psutil.virtual_... | #This program is used for linkage of the UI to the backend algorithm such as the live computer stats shown on the left menu
from platform import platform
import eel
import psutil
import sys
import platform
from frontend_command import Pcommand
eel.init("web")
@eel.expose
def checkram():
memory_info=psutil.virtual_... | en | 0.78592 | #This program is used for linkage of the UI to the backend algorithm such as the live computer stats shown on the left menu #uncomment to print and debug #print(current_ram) #frontend functions #uncomment this line to purely debug this function #alpha_frontend() | 3.056116 | 3 |
train.py | dali-ambiguity/dali-full-anaphora | 5 | 6623063 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import tensorflow as tf
import coref_model as cm
import util
if __name__ == "__main__":
config = util.initialize_from_env()
report_frequency = config["report_f... | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import tensorflow as tf
import coref_model as cm
import util
if __name__ == "__main__":
config = util.initialize_from_env()
report_frequency = config["report_f... | en | 0.54524 | #!/usr/bin/env python #evaluate unlimited cluster only used in the final evaluation # more freq | 1.939866 | 2 |
tests/models/test_highgantt.py | GenomicsNX/panel-highcharts | 107 | 6623064 | # pylint: disable=redefined-outer-name,protected-access
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring
import pytest
from panel_highcharts.models.highgantt import HighGantt
@pytest.fixture
def backup_js_files():
javascript = HighGantt.__javascript__
js_require =... | # pylint: disable=redefined-outer-name,protected-access
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring
import pytest
from panel_highcharts.models.highgantt import HighGantt
@pytest.fixture
def backup_js_files():
javascript = HighGantt.__javascript__
js_require =... | en | 0.439365 | # pylint: disable=redefined-outer-name,protected-access # pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring # pylint: disable=unsubscriptable-object # pylint: disable=unused-argument # Given # When # Then # pylint: disable=unused-argument # When # Then # pylint: disable=unsubsc... | 2.026682 | 2 |
tests/core/txs/test_SimpleTransaction.py | scottdonaldau/QRL | 1 | 6623065 | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock, Mock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core.misc import logger
from qrl.core.AddressState import AddressState
from qrl.core.ChainManager import ChainManager
from qrl.core.TransactionInfo import TransactionInfo
... | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock, Mock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core.misc import logger
from qrl.core.AddressState import AddressState
from qrl.core.ChainManager import ChainManager
from qrl.core.TransactionInfo import TransactionInfo
... | en | 0.926692 | # Alice sending coins to Bob # Test that common Transaction components were copied over. # Test that specific content was copied over. # If we change amount, fee, addr_from, addr_to, (maybe include xmss stuff) txhash should change. # Here we use the tx already defined in setUp() for convenience. # We must sign the tx b... | 2.311695 | 2 |
Sawtooth/families/suse/tests/suse_tests.py | ishtjot/susereumutep | 2 | 6623066 | <filename>Sawtooth/families/suse/tests/suse_tests.py
import unittest
import os
import sys
import getpass
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from client.suse_client import SuseClient #pylint: disable=import-error
from client.suse_exceptions import SuseException #pylint: d... | <filename>Sawtooth/families/suse/tests/suse_tests.py
import unittest
import os
import sys
import getpass
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from client.suse_client import SuseClient #pylint: disable=import-error
from client.suse_exceptions import SuseException #pylint: d... | en | 0.162343 | #pylint: disable=import-error #pylint: disable=import-error #get default values #get user key #get test txn_id | 2.473741 | 2 |
zdiscord/service/integration/chat/discord/macros/General.py | xxdunedainxx/zdiscord | 0 | 6623067 | <filename>zdiscord/service/integration/chat/discord/macros/General.py
from zdiscord.service.messaging.Events import IEvent
async def help_msg(help_msg: str,event: IEvent):
await event.context['message_object'].channel.send(help_msg) | <filename>zdiscord/service/integration/chat/discord/macros/General.py
from zdiscord.service.messaging.Events import IEvent
async def help_msg(help_msg: str,event: IEvent):
await event.context['message_object'].channel.send(help_msg) | none | 1 | 1.599779 | 2 | |
btest1/cudatest.py | originlab/Noho-Training | 0 | 6623068 | import originpro as op
from numba import cuda
import numpy as np
@cuda.jit
def cudakernel0(array):
for i in range(array.size):
array[i] += 0.5
array = np.array([0, 1], np.float32)
print('Initial array:', array)
print('Kernel launch: cudakernel0[1, 1](array)')
cudakernel0[1, 1](array)
print('Updated array... | import originpro as op
from numba import cuda
import numpy as np
@cuda.jit
def cudakernel0(array):
for i in range(array.size):
array[i] += 0.5
array = np.array([0, 1], np.float32)
print('Initial array:', array)
print('Kernel launch: cudakernel0[1, 1](array)')
cudakernel0[1, 1](array)
print('Updated array... | none | 1 | 2.466458 | 2 | |
submissions/abc146/c.py | m-star18/atcoder | 1 | 6623069 | <gh_stars>1-10
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
a, b, x = map(int, readline().split())
ans = 0
for d in range(1, 20):
c = (x - b * d) // a
if c >= 0:
ans = max(ans, min(c, 10 ** d - 1))
pri... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
a, b, x = map(int, readline().split())
ans = 0
for d in range(1, 20):
c = (x - b * d) // a
if c >= 0:
ans = max(ans, min(c, 10 ** d - 1))
print(min(ans, 10 ... | none | 1 | 2.514071 | 3 | |
Instrumentos/Codigos/deprecated/Q4/src/models/Repo.py | aylton-almeida/TIS6 | 0 | 6623070 | from __future__ import annotations
import time
from datetime import datetime
from pandas.core import series
from src.models.AuthToken import AuthToken
from src.models.Issue import Issue
from src.models.Pr import Pr
from src.utils.BundlePhobia import measure_pkg
from src.utils.Graphql import Graphql
from src.utils.Nod... | from __future__ import annotations
import time
from datetime import datetime
from pandas.core import series
from src.models.AuthToken import AuthToken
from src.models.Issue import Issue
from src.models.Pr import Pr
from src.utils.BundlePhobia import measure_pkg
from src.utils.Graphql import Graphql
from src.utils.Nod... | en | 0.649648 | # get bug or error labels # get issues # get query # fetch issues # add issues to list # sleep a bit # calculate issue ratio # get bug or error labels # get prs # get query # fetch prs # add prs to list # sleep a bit # calculate prs ratio # get npm package name | 2.191609 | 2 |
ymir/backend/src/ymir_app/app/db/base.py | Zhang-SJ930104/ymir | 64 | 6623071 | # Import all the models, so that Base has them before being
# imported by Alembic
from app.db.base_class import Base # noqa
from app.models.dataset import Dataset # noqa
from app.models.model import Model # noqa
from app.models.task import Task # noqa
from app.models.user import User # noqa
| # Import all the models, so that Base has them before being
# imported by Alembic
from app.db.base_class import Base # noqa
from app.models.dataset import Dataset # noqa
from app.models.model import Model # noqa
from app.models.task import Task # noqa
from app.models.user import User # noqa
| en | 0.875407 | # Import all the models, so that Base has them before being # imported by Alembic # noqa # noqa # noqa # noqa # noqa | 1.443677 | 1 |
tests/test_tftp_client.py | AstralPresence/pyTFTP | 10 | 6623072 | <reponame>AstralPresence/pyTFTP<filename>tests/test_tftp_client.py
from typing import List, Tuple
from unittest.mock import patch, call, _Call
import tftp
from tests.tftp_test_case import TFTPTestCase
class TestTFTPClient(TFTPTestCase):
def setUp(self):
super(TestTFTPClient, self).setUp()
self.cl... | from typing import List, Tuple
from unittest.mock import patch, call, _Call
import tftp
from tests.tftp_test_case import TFTPTestCase
class TestTFTPClient(TFTPTestCase):
def setUp(self):
super(TestTFTPClient, self).setUp()
self.client = tftp.TFTPClient(*self.srv_addr)
self.client.__enter_... | en | 0.261543 | Test GET/PUT operation without expecting any errors. :param recv_values: list of values that should be returned by recvfrom() :param func: function to use: 'get' or 'put' :param args: arguments for the function :param expected_sendto: expected packets sent (as a list of arguments ... | 2.847775 | 3 |
ps2_newton.py | nadaav/python_projects- | 0 | 6623073 | # 6.00 Problem Set 2
# Successive Approximation
def evaluate_poly(poly, x):
##assert type(poly)== tuple and len(poly)>0
##assert type(x) == float and type(epsilon) == float
result = 0
for i in range(len(poly)):
result += x**float(i)*poly[i]
return result
def compute_eval_deriv(poly, x):
... | # 6.00 Problem Set 2
# Successive Approximation
def evaluate_poly(poly, x):
##assert type(poly)== tuple and len(poly)>0
##assert type(x) == float and type(epsilon) == float
result = 0
for i in range(len(poly)):
result += x**float(i)*poly[i]
return result
def compute_eval_deriv(poly, x):
... | en | 0.550622 | # 6.00 Problem Set 2 # Successive Approximation ##assert type(poly)== tuple and len(poly)>0 ##assert type(x) == float and type(epsilon) == float ##assert type(poly)== tuple and len(poly)>0 ##poly = (-13.39, 0.0, 17.5, 3.0, 1.0) ##x = 0.1 ##poly = (4, 4, 1) ##x = -1.89 Uses Newton's method to find and return a root of a... | 3.87719 | 4 |
devbench/wikidot.py | pxdnbluesoul/Pixeltasim-Alexandra | 1 | 6623074 | from whiffle import wikidotapi
api = wikidotapi.connection()
pages = api.Pages
total = 0
for page in pages:
total += 1
print total
@hook.command
def author(inp):
".author <Author Name> -- Will return details regarding the author"
authpages = []
item for item in pagecache:
if item["created_by"] == inp:
authpa... | from whiffle import wikidotapi
api = wikidotapi.connection()
pages = api.Pages
total = 0
for page in pages:
total += 1
print total
@hook.command
def author(inp):
".author <Author Name> -- Will return details regarding the author"
authpages = []
item for item in pagecache:
if item["created_by"] == inp:
authpa... | en | 0.297196 | #threading.Timer(3600, refresh_cache).start() #refresh_cache() | 3.018477 | 3 |
appengine/src/greenday_api/tests/test_user_api.py | meedan/montage | 6 | 6623075 | <reponame>meedan/montage
"""
Tests for :mod:`greenday_api.user.user_api <greenday_api.user.user_api>`
"""
# LIBRARIES
import mock
from milkman.dairy import milkman
# FRAMEWORK
from protorpc import message_types
from django.contrib.auth import get_user_model
# GREENDAY
from greenday_core.api_exceptions import Forb... | """
Tests for :mod:`greenday_api.user.user_api <greenday_api.user.user_api>`
"""
# LIBRARIES
import mock
from milkman.dairy import milkman
# FRAMEWORK
from protorpc import message_types
from django.contrib.auth import get_user_model
# GREENDAY
from greenday_core.api_exceptions import ForbiddenException
from green... | en | 0.751673 | Tests for :mod:`greenday_api.user.user_api <greenday_api.user.user_api>` # LIBRARIES # FRAMEWORK # GREENDAY Tests for :class:`greenday_api.user.UserAPI <greenday_api.user.UserAPI>` Override creation of test users # override Test that the correct users are returned when doing partial filters on the first_nam... | 2.201894 | 2 |
tests/integration/fileTypeTests.py | chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend | 0 | 6623076 | from __future__ import print_function
import os
import unittest
from sqlalchemy import not_
from dataactcore.interfaces.db import GlobalDB
from dataactcore.models.domainModels import TASLookup
from dataactcore.models.jobModels import Job
from dataactcore.models.lookups import JOB_STATUS_DICT, JOB_TYPE_DICT, FILE_TYPE... | from __future__ import print_function
import os
import unittest
from sqlalchemy import not_
from dataactcore.interfaces.db import GlobalDB
from dataactcore.models.domainModels import TASLookup
from dataactcore.models.jobModels import Job
from dataactcore.models.lookups import JOB_STATUS_DICT, JOB_TYPE_DICT, FILE_TYPE... | en | 0.807824 | Set up class-wide resources. #TODO: refactor into a pytest fixture # TODO: get rid of this flag once we're using a tempdb for test fixtures # Create submissions and jobs, also uploading # the files needed for each job. # next two jobs have the same submission id # commit submissions/jobs and output IDs # Load fields an... | 1.82377 | 2 |
Tianchi2017IMQP-TeamExcited/preprocessing/string_data.py | polossk/DSML-Logs | 2 | 6623077 | import sys
sys.path.append('../')
from utils.csv_helper import *
from utils.xslx_helper import *
from utils.pickle_helper import *
def main():
idics_ABC = [
'A', 'B', 'HY', 'ABY', 'ACU', 'AJJ', 'BMM', 'CMQ',
'ELC', 'ESU', 'FDJ', 'HUY', 'IDE', 'IRX', 'KVU'
]
works = ['raw_data.bin', 'test_a.... | import sys
sys.path.append('../')
from utils.csv_helper import *
from utils.xslx_helper import *
from utils.pickle_helper import *
def main():
idics_ABC = [
'A', 'B', 'HY', 'ABY', 'ACU', 'AJJ', 'BMM', 'CMQ',
'ELC', 'ESU', 'FDJ', 'HUY', 'IDE', 'IRX', 'KVU'
]
works = ['raw_data.bin', 'test_a.... | none | 1 | 2.478613 | 2 | |
backend/tests/links/test_models.py | apirobot/linkanywhere-back | 0 | 6623078 | from unittest import mock
import pytest
from nose.tools import eq_
from django_nose.tools import assert_queryset_equal
from .. import factories as f
pytestmark = pytest.mark.django_db
class TestLinkModel:
def test__str__(self):
user = f.LinkFactory()
eq_(user.__str__(), '{0}: {1}'.format(user.... | from unittest import mock
import pytest
from nose.tools import eq_
from django_nose.tools import assert_queryset_equal
from .. import factories as f
pytestmark = pytest.mark.django_db
class TestLinkModel:
def test__str__(self):
user = f.LinkFactory()
eq_(user.__str__(), '{0}: {1}'.format(user.... | none | 1 | 2.268169 | 2 | |
hypernets/tests/tabular/tb_cuml/feature_importance_test.py | Enpen/Hypernets | 3 | 6623079 | # -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
from ..feature_importance_test import TestPermutationImportance as _TestPermutationImportance
from . import if_cuml_ready, is_cuml_installed
if is_cuml_installed:
import cudf
@if_cuml_ready
class TestCumlPermutationImportance(_TestPermutationImportance):
... | # -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
from ..feature_importance_test import TestPermutationImportance as _TestPermutationImportance
from . import if_cuml_ready, is_cuml_installed
if is_cuml_installed:
import cudf
@if_cuml_ready
class TestCumlPermutationImportance(_TestPermutationImportance):
... | en | 0.736017 | # -*- coding:utf-8 -*- | 2.00859 | 2 |
sqlcell/db.py | tmthyjames/SQLCell | 162 | 6623080 | from sqlalchemy import create_engine
from sqlalchemy.engine.url import make_url
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy import create_engine
from sqlalchemy import desc, asc
from sqlalchemy.engine.base import Engine
import pandas as pd
import re
... | from sqlalchemy import create_engine
from sqlalchemy.engine.url import make_url
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy import create_engine
from sqlalchemy import desc, asc
from sqlalchemy.engine.base import Engine
import pandas as pd
import re
... | en | 0.624827 | remove all engines from sqlcell.db: %%sql refresh may have to use @cell_line_magic. add multiple new engines: %%sql add foo=<engine str> bar=<another engine str> baz=<another engine str> #new engines #engine lookup | 2.482173 | 2 |
GUI/AdminUI/Admin_UI.py | BrendanCheong/BT2102-OSHES-Group16 | 5 | 6623081 | <reponame>BrendanCheong/BT2102-OSHES-Group16
import resources_rc
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1914, 1077)
MainWindow.setMinimumSize(QtCore.QSize(1000, 500))
... | import resources_rc
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1914, 1077)
MainWindow.setMinimumSize(QtCore.QSize(1000, 500))
MainWindow.setStyleSheet("background-co... | en | 0.245059 | #C7D2FE;") #2DD4BF, stop:1 #0EA5E9);\n" #2DD4BF, stop:1 #0EA5E9);\n" #2DD4BF, stop:1 #0EA5E9);\n" #2DD4BF, stop:1 #0EA5E9);\n" #2DD4BF, stop:1 #0EA5E9);\n" #2DD4BF, stop:1 #0EA5E9);\n" #94A3B8;\n" #E5E7EB;\n" #6366F1, stop:1 #7C3AED);\n" #4338CA, stop:1 #5B21B6);\n" #94A3B8;\n" #94A3B8;\n" #0F766E\n" #0E7490);\n" #0F76... | 2.242481 | 2 |
src/exams/doctor_time.py | Jakob-Daugherty/ftlengine | 1 | 6623082 | import ntplib
import time
from ..plugins.base import BasePlugin
from ..plugins.doctor import BaseExamination
class DoctorTimePlugin(BasePlugin):
"""
Examinations to check the time on the docker server is roughly correct
"""
requires = ["doctor"]
def load(self):
self.add_catalog_item("do... | import ntplib
import time
from ..plugins.base import BasePlugin
from ..plugins.doctor import BaseExamination
class DoctorTimePlugin(BasePlugin):
"""
Examinations to check the time on the docker server is roughly correct
"""
requires = ["doctor"]
def load(self):
self.add_catalog_item("do... | en | 0.829351 | Examinations to check the time on the docker server is roughly correct Checks the datetime on the docker server is not too out of drift Testing docker clock sync # Check to see if the docker server agrees with our clock Testing local clock sync # Query an NTP server for the time | 2.698454 | 3 |
PI/Renderer/Camera/PerspectiveCamera.py | HotShot0901/PI | 0 | 6623083 | <gh_stars>0
from .Camera import Camera
from ..RenderCommand import RenderCommand
import pyrr
class PerspectiveCamera(Camera):
__slots__ = "__Fov", "__Near", "__Far"
def __init__(self, fov: float, aspectRatio: float, near: float=0.01, far: float=1000) -> None:
self.__Fov = fov
self._As... | from .Camera import Camera
from ..RenderCommand import RenderCommand
import pyrr
class PerspectiveCamera(Camera):
__slots__ = "__Fov", "__Near", "__Far"
def __init__(self, fov: float, aspectRatio: float, near: float=0.01, far: float=1000) -> None:
self.__Fov = fov
self._AspectRatio = ... | none | 1 | 2.402431 | 2 | |
scripts/src/build_sources/__main__.py | APotyomkin/awesome-bugs | 1 | 6623084 | <reponame>APotyomkin/awesome-bugs
import os
import sys
# Here we generate a CMakeLists file based on the CPP sources
# and make a build using it
# As an input it takes:
# - a path to a folder with source files
# - a path to a resulting build folder
CMAKE_TEMPLATE = """
cmake_minimum_required(VERSION 3.20)
project... | import os
import sys
# Here we generate a CMakeLists file based on the CPP sources
# and make a build using it
# As an input it takes:
# - a path to a folder with source files
# - a path to a resulting build folder
CMAKE_TEMPLATE = """
cmake_minimum_required(VERSION 3.20)
project(AwesomeBugs)
set(CMAKE_CXX_STAND... | en | 0.723381 | # Here we generate a CMakeLists file based on the CPP sources # and make a build using it # As an input it takes: # - a path to a folder with source files # - a path to a resulting build folder cmake_minimum_required(VERSION 3.20) project(AwesomeBugs) set(CMAKE_CXX_STANDARD 14) add_executable(AwesomeBugs {files... | 2.884973 | 3 |
heartbridge/data.py | mm/heartbridge | 11 | 6623085 | <gh_stars>10-100
"""Entity definitions (data classes) for Heartbridge. Each
class is a different record type from the Health app.
"""
from dataclasses import dataclass, fields, InitVar
from typing import ClassVar
from datetime import datetime
@dataclass(order=True)
class BaseHealthReading:
timestamp: datetime
... | """Entity definitions (data classes) for Heartbridge. Each
class is a different record type from the Health app.
"""
from dataclasses import dataclass, fields, InitVar
from typing import ClassVar
from datetime import datetime
@dataclass(order=True)
class BaseHealthReading:
timestamp: datetime
value: InitVar[... | en | 0.79126 | Entity definitions (data classes) for Heartbridge. Each class is a different record type from the Health app. Gets the value of a health reading, determined by the `value_attribute` class variable. Converts the data object to a dictionary. Call only on a subclass of BaseHealthReading. | 3.44401 | 3 |
wxviews/__init__.py | eumis/wxviews | 6 | 6623086 | <gh_stars>1-10
"""Package adapts pyviews for using with wxpython"""
from pyviews.setters import import_global, inject_global, set_global, call, call_args
from pyviews.code import Code
from pyviews.containers import Container, View, For, If
from pyviews.presenter import Presenter, PresenterNode, add_reference
from wxv... | """Package adapts pyviews for using with wxpython"""
from pyviews.setters import import_global, inject_global, set_global, call, call_args
from pyviews.code import Code
from pyviews.containers import Container, View, For, If
from pyviews.presenter import Presenter, PresenterNode, add_reference
from wxviews.sizers imp... | en | 0.858433 | Package adapts pyviews for using with wxpython | 1.933195 | 2 |
amazonPriceTracker/app/templatetags/colorize.py | younesaitmha/amazon-price-tracker | 12 | 6623087 | <filename>amazonPriceTracker/app/templatetags/colorize.py
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def colorize(value):
mark = str(value)[:1]
if mark == "-":
html_str = f"<span style='color:green'>${value}</span>"
elif... | <filename>amazonPriceTracker/app/templatetags/colorize.py
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def colorize(value):
mark = str(value)[:1]
if mark == "-":
html_str = f"<span style='color:green'>${value}</span>"
elif... | none | 1 | 2.593407 | 3 | |
likes/api/views.py | BattleWoLFz99/Twitchain | 0 | 6623088 | <gh_stars>0
from django.utils.decorators import method_decorator
from inbox.services import NotificationService
from likes.api.serializers import (
LikeSerializer,
LikeSerializerForCancel,
LikeSerializerForCreate,
)
from likes.models import Like
from ratelimit.decorators import ratelimit
from rest_framework... | from django.utils.decorators import method_decorator
from inbox.services import NotificationService
from likes.api.serializers import (
LikeSerializer,
LikeSerializerForCancel,
LikeSerializerForCreate,
)
from likes.models import Like
from ratelimit.decorators import ratelimit
from rest_framework import view... | none | 1 | 1.930623 | 2 | |
CorpusCleaner.py | teaholic/NLP | 0 | 6623089 | """
Created on Sun Mar 22 14:57:00 2015
@author: bigiei
"""
# Opening my csv file
dataset = open("Dataset.txt", "w")
# Opening text and isolating every word
text = open("Corpus.txt", "r")
for line in text :
for word in line.split() :
word = (word)
# generating and classificating tokens
... | """
Created on Sun Mar 22 14:57:00 2015
@author: bigiei
"""
# Opening my csv file
dataset = open("Dataset.txt", "w")
# Opening text and isolating every word
text = open("Corpus.txt", "r")
for line in text :
for word in line.split() :
word = (word)
# generating and classificating tokens
... | en | 0.749395 | Created on Sun Mar 22 14:57:00 2015 @author: bigiei # Opening my csv file # Opening text and isolating every word # generating and classificating tokens # finding existing tags # # TAG CODEBOOK: # LSP = language for specific purpose # # tagging non LSP as NA # rimming punctuation # tagging non LSP as NA # defining res... | 3.046551 | 3 |
Gallery/migrations/0008_imagesclient_column.py | CiganOliviu/InfiniteShoot | 1 | 6623090 | # Generated by Django 3.0.8 on 2021-02-20 12:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Gallery', '0007_platformpresentationimage_column'),
]
operations = [
migrations.AddField(
model_name='imagesclient',
... | # Generated by Django 3.0.8 on 2021-02-20 12:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Gallery', '0007_platformpresentationimage_column'),
]
operations = [
migrations.AddField(
model_name='imagesclient',
... | en | 0.803852 | # Generated by Django 3.0.8 on 2021-02-20 12:56 | 1.955355 | 2 |
Util.py | landicefu/OKExDailyReport | 1 | 6623091 |
def read_all(path: str, strip: bool = True) -> str:
with open(path, 'r') as file:
content = file.read()
if strip:
return content.strip()
else:
return content
|
def read_all(path: str, strip: bool = True) -> str:
with open(path, 'r') as file:
content = file.read()
if strip:
return content.strip()
else:
return content
| none | 1 | 3.190564 | 3 | |
bot/__init__.py | yiannisha/UrbanDictionaryBot | 0 | 6623092 | """ A module to handle running the bot. """
| """ A module to handle running the bot. """
| en | 0.456491 | A module to handle running the bot. | 0.971533 | 1 |
openapi_schema_to_json_schema/to_jsonschema.py | pglass/py-openapi-jsonschema-converter | 12 | 6623093 | <filename>openapi_schema_to_json_schema/to_jsonschema.py<gh_stars>10-100
import json
class InvalidTypeError(ValueError):
def __init__(self, msg):
super(InvalidTypeError, self).__init__(msg)
def _prepare(schema, options=None):
notSupported = [
'nullable', 'discriminator', 'readOnly',
... | <filename>openapi_schema_to_json_schema/to_jsonschema.py<gh_stars>10-100
import json
class InvalidTypeError(ValueError):
def __init__(self, msg):
super(InvalidTypeError, self).__init__(msg)
def _prepare(schema, options=None):
notSupported = [
'nullable', 'discriminator', 'readOnly',
... | en | 0.75973 | #' #' # note: don't shadow the `property` built-in # https://github.com/pglass/py-openapi-schema-to-json-schema/issues/10 | 2.282441 | 2 |
xixiang/services.py | LKI/xixiang | 15 | 6623094 | <gh_stars>10-100
import datetime
import http
import uuid
from urllib.parse import urlencode
import requests
import xixiang
class XiXiang:
MENU_TYPE_LUNCH = "2"
MENU_TYPE_DINNER = "4"
ORDER_SUCCESS = "2"
@classmethod
def login(cls, phone, password, openid=None):
"""
:rtype: XiXi... | import datetime
import http
import uuid
from urllib.parse import urlencode
import requests
import xixiang
class XiXiang:
MENU_TYPE_LUNCH = "2"
MENU_TYPE_DINNER = "4"
ORDER_SUCCESS = "2"
@classmethod
def login(cls, phone, password, openid=None):
"""
:rtype: XiXiang
"""
... | en | 0.190398 | :rtype: XiXiang :type business: xixiang.models.Business :type menu: xixiang.models.Menu :type item: xixiang.models.Item :type num: int :rtype: dict :rtype: dict | 2.964294 | 3 |
tools/linked_list.py | niki4/leetcode_py3 | 0 | 6623095 | <reponame>niki4/leetcode_py3<gh_stars>0
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def get_linked_list_representation(node: ListNode) -> str:
list_values = list()
while node:
list_values.append(str(node... | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def get_linked_list_representation(node: ListNode) -> str:
list_values = list()
while node:
list_values.append(str(node.val))
node = node.next
retu... | en | 0.713049 | # Definition for singly-linked list. Makes circulated linked list so that last item (tail) linked to the first item (head) | 3.932898 | 4 |
loader/loader.py | jeremyagray/django-loader | 0 | 6623096 | # ******************************************************************************
#
# django-loader, a configuration and secret loader for Django
#
# loader.py: main loader functions
#
# Copyright (C) 2021 <NAME> <<EMAIL>>.
#
# SPDX-License-Identifier: MIT
#
# ***********************************************************... | # ******************************************************************************
#
# django-loader, a configuration and secret loader for Django
#
# loader.py: main loader functions
#
# Copyright (C) 2021 <NAME> <<EMAIL>>.
#
# SPDX-License-Identifier: MIT
#
# ***********************************************************... | en | 0.638884 | # ****************************************************************************** # # django-loader, a configuration and secret loader for Django # # loader.py: main loader functions # # Copyright (C) 2021 <NAME> <<EMAIL>>. # # SPDX-License-Identifier: MIT # # ***********************************************************... | 2.496598 | 2 |
examples/trials/cifar10_grad_match/cords/selectionstrategies/supervisedlearning/__init__.py | savan77/nni | 0 | 6623097 | from .craigstrategy import CRAIGStrategy
from .dataselectionstrategy import DataSelectionStrategy
from .glisterstrategy import GLISTERStrategy
from .randomstrategy import RandomStrategy
from .submodularselectionstrategy import SubmodularSelectionStrategy
from .ompgradmatchstrategy import OMPGradMatchStrategy
__version... | from .craigstrategy import CRAIGStrategy
from .dataselectionstrategy import DataSelectionStrategy
from .glisterstrategy import GLISTERStrategy
from .randomstrategy import RandomStrategy
from .submodularselectionstrategy import SubmodularSelectionStrategy
from .ompgradmatchstrategy import OMPGradMatchStrategy
__version... | none | 1 | 1.048148 | 1 | |
Observability/logging-example.py | kraluc/DevCore | 0 | 6623098 | <filename>Observability/logging-example.py
#!/bin/env python
import logging
# Set logging level
logging.basicConfig(level=logging.INFO)
logging.info('This will get logged')
logging.error('This will get logged too')
logging.debug('This will NOT get logged')
def doSomething():
raise
try:
doSomething()
except... | <filename>Observability/logging-example.py
#!/bin/env python
import logging
# Set logging level
logging.basicConfig(level=logging.INFO)
logging.info('This will get logged')
logging.error('This will get logged too')
logging.debug('This will NOT get logged')
def doSomething():
raise
try:
doSomething()
except... | en | 0.351013 | #!/bin/env python # Set logging level | 2.959316 | 3 |
21_Classes_Objects/01_Classes.py | jmmedel/Python-Reference | 0 | 6623099 | """
Author: <NAME>
Tutorial 21 : Classes Objects
"""
"""
Python Classes/Objects
Python is an object oriented programming language.
Almost everything in Python is an object, with its properties and methods.
A Class is like an object constructor, or a "blueprint" for creating objects.
Create a Class
To create a... | """
Author: <NAME>
Tutorial 21 : Classes Objects
"""
"""
Python Classes/Objects
Python is an object oriented programming language.
Almost everything in Python is an object, with its properties and methods.
A Class is like an object constructor, or a "blueprint" for creating objects.
Create a Class
To create a... | en | 0.863824 | Author: <NAME> Tutorial 21 : Classes Objects Python Classes/Objects Python is an object oriented programming language. Almost everything in Python is an object, with its properties and methods. A Class is like an object constructor, or a "blueprint" for creating objects. Create a Class To create a class, use the ... | 4.052357 | 4 |
organiser/log.py | Tauseef-Hilal/DesktopOrganiser | 3 | 6623100 | import os
import logging
from logging.handlers import RotatingFileHandler
from datetime import date
usr_dir = os.path.join(os.getcwd().split(os.getlogin())[0], os.getlogin())
desktop = os.path.join(usr_dir, "Desktop")
target = os.path.join(desktop, "Target")
log_folder = os.path.join(target, "Log")
if not os.path.isd... | import os
import logging
from logging.handlers import RotatingFileHandler
from datetime import date
usr_dir = os.path.join(os.getcwd().split(os.getlogin())[0], os.getlogin())
desktop = os.path.join(usr_dir, "Desktop")
target = os.path.join(desktop, "Target")
log_folder = os.path.join(target, "Log")
if not os.path.isd... | none | 1 | 2.727565 | 3 | |
python/src/stacks_and_queues.py | marvincolgin/data-structures-and-algorythms | 5 | 6623101 | import sys
sys.path.insert(0, '../linked_list')
from link_list import LinkList
# ********************************
class Stack():
_data = None
def __init__(self):
self._data = LinkList()
def count(self) -> int:
return self._data.count()
def pop(self) -> object:
... | import sys
sys.path.insert(0, '../linked_list')
from link_list import LinkList
# ********************************
class Stack():
_data = None
def __init__(self):
self._data = LinkList()
def count(self) -> int:
return self._data.count()
def pop(self) -> object:
... | en | 0.706292 | # ******************************** # ********************************* # Add a value to the queue # Remove entry from queue with a given value # NOTE: will only remove the first element found with val # Get value from the head of the queue (without removing it) | 3.574613 | 4 |
2020/day10_sol.py | vladan-stojnic/AdventOfCode | 0 | 6623102 | <reponame>vladan-stojnic/AdventOfCode
from collections import Counter
from functools import lru_cache
def read_input(path):
with open(path, 'r') as f:
data = f.read()
data = data.splitlines()
data = [int(d) for d in data]
return data
@lru_cache
def weight(val, m):
global data_sorted_set
... | from collections import Counter
from functools import lru_cache
def read_input(path):
with open(path, 'r') as f:
data = f.read()
data = data.splitlines()
data = [int(d) for d in data]
return data
@lru_cache
def weight(val, m):
global data_sorted_set
if val == m:
return 1
... | en | 0.538791 | # Part 1 # Part 2 | 3.507862 | 4 |
backend/api/models.py | TChi91/drf-reactjs | 0 | 6623103 | <gh_stars>0
from django.db import models
from rest_framework import serializers
class Message(models.Model):
subject = models.CharField(max_length=200)
body = models.TextField()
| from django.db import models
from rest_framework import serializers
class Message(models.Model):
subject = models.CharField(max_length=200)
body = models.TextField() | none | 1 | 2.038357 | 2 | |
examples/quadratic.py | seba-1511/randopt | 115 | 6623104 | #!/usr/bin/env python3
import randopt as ro
from random import random
def loss(x, y):
return [(x**2 + y**2 + random()) / i for i in range(1, 51)]
if __name__ == '__main__':
exp = ro.Experiment('quadratic', params={
'x': ro.Gaussian(),
'y': ro.Uniform(-0.5, 0.5)
})
for _ in range(20):... | #!/usr/bin/env python3
import randopt as ro
from random import random
def loss(x, y):
return [(x**2 + y**2 + random()) / i for i in range(1, 51)]
if __name__ == '__main__':
exp = ro.Experiment('quadratic', params={
'x': ro.Gaussian(),
'y': ro.Uniform(-0.5, 0.5)
})
for _ in range(20):... | fr | 0.221828 | #!/usr/bin/env python3 | 3.1776 | 3 |
py_tdlib/constructors/authorization_state_ready.py | Mr-TelegramBot/python-tdlib | 24 | 6623105 | from ..factory import Type
class authorizationStateReady(Type):
pass
| from ..factory import Type
class authorizationStateReady(Type):
pass
| none | 1 | 1.224905 | 1 | |
kdap/converter/wiki_clean.py | AayushSabharwal/kdap | 9 | 6623106 | <filename>kdap/converter/wiki_clean.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 20 23:02:43 2020
@author: descentis
"""
import re
from urllib.parse import quote
from html.entities import name2codepoint
def dropSpans(spans, text):
"""
Drop from text the blocks identified in :param... | <filename>kdap/converter/wiki_clean.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 20 23:02:43 2020
@author: descentis
"""
import re
from urllib.parse import quote
from html.entities import name2codepoint
def dropSpans(spans, text):
"""
Drop from text the blocks identified in :param... | en | 0.441166 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Created on Wed May 20 23:02:43 2020 @author: descentis Drop from text the blocks identified in :param spans:, possibly nested. # handle nesting A matching function for nested expressions, e.g. namespaces and tables. # partition text in separate blocks { } { } # pairs (s, ... | 3.195527 | 3 |
hackulus/utils.py | jungkumseok/hackulus | 0 | 6623107 | <filename>hackulus/utils.py
import sys, code, re
from jokes.core.console import Console as jokesConsole
from io import StringIO
from contextlib import contextmanager
@contextmanager
def std_redirector(stdin=sys.stdin, stdout=sys.stdin, stderr=sys.stderr):
tmp_fds = stdin, stdout, stderr
orig_fds = sys.stdin, s... | <filename>hackulus/utils.py
import sys, code, re
from jokes.core.console import Console as jokesConsole
from io import StringIO
from contextlib import contextmanager
@contextmanager
def std_redirector(stdin=sys.stdin, stdout=sys.stdin, stderr=sys.stderr):
tmp_fds = stdin, stdout, stderr
orig_fds = sys.stdin, s... | en | 0.61085 | #Check for forbidden command regex patterns Called within self.set_language() method Do something and return a dict {'concat': bool, 'print': str} Run inputstring as shell command and return a dict {'concat': bool, 'print': str} Run inputstring as shell command and return a dict {'concat': bool, 'print': str} | 2.384011 | 2 |
functions/types_of_arguments_in_function/variabel_scope.py | Mr-Sunglasses/Function-OOPS-PY | 0 | 6623108 | <reponame>Mr-Sunglasses/Function-OOPS-PY
# Local Variable
a = 22
def myfunction():
a = 22
a+=1
print(a)
def see():
global a
a+=1
print("modified = ",a)
x = 10
def app():
global x
x+=20
print(x)
def work():
x = 22
z = globals()['x']
print(z)
work() | # Local Variable
a = 22
def myfunction():
a = 22
a+=1
print(a)
def see():
global a
a+=1
print("modified = ",a)
x = 10
def app():
global x
x+=20
print(x)
def work():
x = 22
z = globals()['x']
print(z)
work() | en | 0.792356 | # Local Variable | 3.53058 | 4 |
bot/plugins/upload_servers/__init__.py | grahamtito/TelegramFiletoCloud | 0 | 6623109 | <reponame>grahamtito/TelegramFiletoCloud
from .fileio_upload import fileIO
from .gofileio import gofileIO
from .transfersh import transferSH
from .anonymfiles import anonymFiles
from .aparat import aparatUPPer
from .splus import splusUPPer
| from .fileio_upload import fileIO
from .gofileio import gofileIO
from .transfersh import transferSH
from .anonymfiles import anonymFiles
from .aparat import aparatUPPer
from .splus import splusUPPer | none | 1 | 1.070129 | 1 | |
nomadgram2/images/migrations/0002_auto_20180527_2229.py | tonky0110/NomadGram2 | 0 | 6623110 | # Generated by Django 2.0.5 on 2018-05-27 13:29
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='comment',
... | # Generated by Django 2.0.5 on 2018-05-27 13:29
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='comment',
... | en | 0.793437 | # Generated by Django 2.0.5 on 2018-05-27 13:29 | 1.714998 | 2 |
src/analytics/migrations/0003_auto_20200410_0153.py | ResearchHub/ResearchHub-Backend-Open | 18 | 6623111 | <gh_stars>10-100
# Generated by Django 2.2.11 on 2020-04-10 01:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('analytics', '0002_websitevisits_saw_signup_banner'),
]
operations = [
migrations.AlterField(
model_name='websi... | # Generated by Django 2.2.11 on 2020-04-10 01:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('analytics', '0002_websitevisits_saw_signup_banner'),
]
operations = [
migrations.AlterField(
model_name='websitevisits',
... | en | 0.793744 | # Generated by Django 2.2.11 on 2020-04-10 01:53 | 1.490583 | 1 |
telegram/admin.py | aquametalabs/django-telegram | 10 | 6623112 | <gh_stars>1-10
from django.contrib import admin
from telegram.models import *
class SubscriptionPlatformInline(admin.TabularInline):
model = SubscriptionPlatform
extra = 1
class SubscriptionAdmin(admin.ModelAdmin):
fields = ('channel', 'level', 'disabled',)
inlines = (SubscriptionPlatformInline,)
... | from django.contrib import admin
from telegram.models import *
class SubscriptionPlatformInline(admin.TabularInline):
model = SubscriptionPlatform
extra = 1
class SubscriptionAdmin(admin.ModelAdmin):
fields = ('channel', 'level', 'disabled',)
inlines = (SubscriptionPlatformInline,)
def save_m... | none | 1 | 1.93968 | 2 | |
backend/apps/dorm/urls.py | YernarT/dormitory_management_system | 1 | 6623113 | <filename>backend/apps/dorm/urls.py<gh_stars>1-10
from django.conf.urls import url
from dorm.views import CityView, CitySingleView, DormView, DormSingleView, OrganizationView, OrganizationCategoryView, RoomView, RoomSingleView, BedView, BedSingleView
urlpatterns = [
url(r'^dorm/city/$', CityView.as_view()),
u... | <filename>backend/apps/dorm/urls.py<gh_stars>1-10
from django.conf.urls import url
from dorm.views import CityView, CitySingleView, DormView, DormSingleView, OrganizationView, OrganizationCategoryView, RoomView, RoomSingleView, BedView, BedSingleView
urlpatterns = [
url(r'^dorm/city/$', CityView.as_view()),
u... | none | 1 | 1.99098 | 2 | |
tact/fastmrca.py | jonchang/tact | 2 | 6623114 | """Singleton object that helps speed up MRCA lookups."""
from __future__ import division
from .tree_util import get_tip_labels
global tree
def initialize(phy):
"""
Initialize the fastmrca singleton with a tree.
"""
global tree
tree = phy
def bitmask(labels):
"""
Gets a bitmask for the... | """Singleton object that helps speed up MRCA lookups."""
from __future__ import division
from .tree_util import get_tip_labels
global tree
def initialize(phy):
"""
Initialize the fastmrca singleton with a tree.
"""
global tree
tree = phy
def bitmask(labels):
"""
Gets a bitmask for the... | en | 0.834152 | Singleton object that helps speed up MRCA lookups. Initialize the fastmrca singleton with a tree. Gets a bitmask for the taxa in `labels`, potentially in parallel. Pulls a MRCA node out for the taxa in `labels`. Helper function for submitting stuff. | 2.467895 | 2 |
sktime/utils/testing.py | TonyBagnall/sktime | 2 | 6623115 | <filename>sktime/utils/testing.py
import pandas as pd
def generate_df_from_array(array, n_rows=10, n_cols=1):
return pd.DataFrame([[pd.Series(array) for _ in range(n_cols)] for _ in range(n_rows)],
columns=[f'col{c}' for c in range(n_cols)])
| <filename>sktime/utils/testing.py
import pandas as pd
def generate_df_from_array(array, n_rows=10, n_cols=1):
return pd.DataFrame([[pd.Series(array) for _ in range(n_cols)] for _ in range(n_rows)],
columns=[f'col{c}' for c in range(n_cols)])
| none | 1 | 3.023628 | 3 | |
challenges/local_exceptions.py | architv/chcli | 337 | 6623116 | <reponame>architv/chcli
class IncorrectParametersException(Exception):
pass | class IncorrectParametersException(Exception):
pass | none | 1 | 1.101368 | 1 | |
instructors/course-2015/oop/lab/deck_o_cards.py | mgadagin/PythonClass | 46 | 6623117 | <reponame>mgadagin/PythonClass
import random
from collections import deque
class PlayingCard(object):
'''A classic 'Playing Card' for traditional games such as poker, war and go fish.
each PlayingCard has a rank, suit, and color
'''
def __init__(self, rank, suit): #every single instance needs ... | import random
from collections import deque
class PlayingCard(object):
'''A classic 'Playing Card' for traditional games such as poker, war and go fish.
each PlayingCard has a rank, suit, and color
'''
def __init__(self, rank, suit): #every single instance needs a rank and suit!
self... | en | 0.840605 | A classic 'Playing Card' for traditional games such as poker, war and go fish. each PlayingCard has a rank, suit, and color #every single instance needs a rank and suit! #unneccesary example of a color of a card, however good illustration of an @property #color should be a data attribute but it needs calculation... | 3.95139 | 4 |
loldib/getratings/models/NA/na_veigar/na_veigar_top.py | koliupy/loldib | 0 | 6623118 | <filename>loldib/getratings/models/NA/na_veigar/na_veigar_top.py
from getratings.models.ratings import Ratings
class NA_Veigar_Top_Aatrox(Ratings):
pass
class NA_Veigar_Top_Ahri(Ratings):
pass
class NA_Veigar_Top_Akali(Ratings):
pass
class NA_Veigar_Top_Alistar(Ratings):
pass
class NA_Veigar_Top_... | <filename>loldib/getratings/models/NA/na_veigar/na_veigar_top.py
from getratings.models.ratings import Ratings
class NA_Veigar_Top_Aatrox(Ratings):
pass
class NA_Veigar_Top_Ahri(Ratings):
pass
class NA_Veigar_Top_Akali(Ratings):
pass
class NA_Veigar_Top_Alistar(Ratings):
pass
class NA_Veigar_Top_... | none | 1 | 1.493826 | 1 | |
core/utilities/__init__.py | yellowbyte/zero-footprint-opaque-predicates | 6 | 6623119 | """Contains general utilities functions and global configs."""
import logging
import argparse
import subprocess # noqa
from .framac_engineer import * # noqa
# Configurations
######################
__CONFIGS = {
'metadata_dir': '/tmp', # noqa
'delete_metadata': True,
'srcfolder': None,
# Obfuscat... | """Contains general utilities functions and global configs."""
import logging
import argparse
import subprocess # noqa
from .framac_engineer import * # noqa
# Configurations
######################
__CONFIGS = {
'metadata_dir': '/tmp', # noqa
'delete_metadata': True,
'srcfolder': None,
# Obfuscat... | en | 0.763789 | Contains general utilities functions and global configs. # noqa # noqa # Configurations ###################### # noqa # Obfuscation for the inserted opaque predicates # We purposely make it deterministic so we can detect our # opaque predicates for evaluation with other deobfuscation tools. # Also in practice, the obfu... | 2.443652 | 2 |
dcbench/common/table.py | data-centric-ai/dcbench | 40 | 6623120 | <reponame>data-centric-ai/dcbench
import copy
from dataclasses import dataclass
from itertools import chain
from typing import Dict, Iterator, Mapping, Optional, Sequence, Union
import pandas as pd
Attribute = Union[int, float, str, bool]
@dataclass
class AttributeSpec:
description: str
attribute_type: type... | import copy
from dataclasses import dataclass
from itertools import chain
from typing import Dict, Iterator, Mapping, Optional, Sequence, Union
import pandas as pd
Attribute = Union[int, float, str, bool]
@dataclass
class AttributeSpec:
description: str
attribute_type: type
optional: bool = False
clas... | none | 1 | 2.541132 | 3 | |
cate/ops/plot_helpers.py | strawpants/cate | 34 | 6623121 | <reponame>strawpants/cate
# The MIT License (MIT)
# Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors
#
# 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... | # The MIT License (MIT)
# Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors
#
# 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 wi... | en | 0.702714 | # The MIT License (MIT) # Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors # # 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 wi... | 1.560701 | 2 |
nipyper/interfaces/__init__.py | jyotishkabiswas/nipyper | 0 | 6623122 | from flask.ext.restful import reqparse, abort, Resource, marshal
from nipyper.app import api
from .registry import registry, interface_spec, module_spec
from .tasks import resolve
from traceback import format_exception
import sys
interfaceParser = reqparse.RequestParser()
interfaceParser.add_argument('inputs', type=di... | from flask.ext.restful import reqparse, abort, Resource, marshal
from nipyper.app import api
from .registry import registry, interface_spec, module_spec
from .tasks import resolve
from traceback import format_exception
import sys
interfaceParser = reqparse.RequestParser()
interfaceParser.add_argument('inputs', type=di... | en | 0.928934 | # decorators = [auth.login_required] # faster to resolve synchronously rather than go through Celery | 2.010434 | 2 |
models/database.py | Mmx233/blivechat | 1 | 6623123 | # -*- coding: utf-8 -*-
from typing import *
import sqlalchemy.ext.declarative
import sqlalchemy.orm
import config
OrmBase = sqlalchemy.ext.declarative.declarative_base()
_engine = None
_DbSession: Optional[Type[sqlalchemy.orm.Session]] = None
def init(_debug):
cfg = config.get_config()
global _engine, _Db... | # -*- coding: utf-8 -*-
from typing import *
import sqlalchemy.ext.declarative
import sqlalchemy.orm
import config
OrmBase = sqlalchemy.ext.declarative.declarative_base()
_engine = None
_DbSession: Optional[Type[sqlalchemy.orm.Session]] = None
def init(_debug):
cfg = config.get_config()
global _engine, _Db... | en | 0.300423 | # -*- coding: utf-8 -*- # engine = sqlalchemy.create_engine(cfg.database_url, echo=debug) | 2.460249 | 2 |
databind.json/src/databind/json/modules/collection.py | NiklasRosenstein/databind | 2 | 6623124 |
import typing as t
from databind.core import Context, Direction, Converter, CollectionType
class CollectionConverter(Converter):
def __init__(self, json_type: t.Type[t.Collection] = list) -> None:
self.json_type = json_type
def convert(self, ctx: Context) -> t.Any:
assert isinstance(ctx.type, Collectio... |
import typing as t
from databind.core import Context, Direction, Converter, CollectionType
class CollectionConverter(Converter):
def __init__(self, json_type: t.Type[t.Collection] = list) -> None:
self.json_type = json_type
def convert(self, ctx: Context) -> t.Any:
assert isinstance(ctx.type, Collectio... | it | 0.190853 | # type: ignore | 2.458035 | 2 |
test_app/tests/conftest.py | pehala/cached-markdown-field | 0 | 6623125 | <filename>test_app/tests/conftest.py<gh_stars>0
import pytest
@pytest.fixture(scope="function")
def use_runtime_cache(settings):
settings.MARKDOWN_CACHE_RUNTIME = True
@pytest.fixture(scope="function")
def no_cache(settings):
settings.MARKDOWN_CACHE = False
| <filename>test_app/tests/conftest.py<gh_stars>0
import pytest
@pytest.fixture(scope="function")
def use_runtime_cache(settings):
settings.MARKDOWN_CACHE_RUNTIME = True
@pytest.fixture(scope="function")
def no_cache(settings):
settings.MARKDOWN_CACHE = False
| none | 1 | 1.459633 | 1 | |
lib/model/ops/pcl_losses/pcl_losses.py | StillWaterRUN/D-MIL.pytorch | 10 | 6623126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 21 19:48:44 2019
@author: vasgaoweithu
"""
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from torch.nn.modules.module import Mo... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 21 19:48:44 2019
@author: vasgaoweithu
"""
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from torch.nn.modules.module import Mo... | en | 0.425406 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Created on Sat Sep 21 19:48:44 2019 @author: vasgaoweithu | 2.164633 | 2 |
utils/augmentation/smpl_augmentation.py | yuepengzhan/HierarchicalProbabilistic3DHuman | 1 | 6623127 | <gh_stars>1-10
import torch
from smplx.lbs import batch_rodrigues
def uniform_sample_shape(batch_size, mean_shape, delta_betas_range):
"""
Uniform sampling of shape parameter deviations from the mean.
"""
l, h = delta_betas_range
delta_betas = (h-l)*torch.rand(batch_size, mean_shape.shape[0], dev... | import torch
from smplx.lbs import batch_rodrigues
def uniform_sample_shape(batch_size, mean_shape, delta_betas_range):
"""
Uniform sampling of shape parameter deviations from the mean.
"""
l, h = delta_betas_range
delta_betas = (h-l)*torch.rand(batch_size, mean_shape.shape[0], device= mean_shape... | en | 0.658951 | Uniform sampling of shape parameter deviations from the mean. # (bs, num_smpl_betas) Gaussian sampling of shape parameter deviations from the mean. # (bs, num_smpl_betas) Uniform sampling of random 3D rotation matrices using QR decomposition. Source: https://arxiv.org/pdf/math-ph/0609050.pdf # matmul with diagonal ... | 2.846479 | 3 |
install/core/python/tank/folder/folder_types/__init__.py | JoanAzpeitia/lp_sg | 0 | 6623128 | # Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... | # Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... | en | 0.848096 | # Copyright (c) 2013 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to the S... | 1.169287 | 1 |
projects/models.py | tungr/Django-Site | 0 | 6623129 | from django.db import models
from django.core.files.storage import FileSystemStorage
# Create your models here.
# Uses an Object-Relational Mapper (ORM). Similar to a SQL database, but without having to learn another language
# Creates database in SQLite format by default (Can use others as well)
fs = FileSystemStorag... | from django.db import models
from django.core.files.storage import FileSystemStorage
# Create your models here.
# Uses an Object-Relational Mapper (ORM). Similar to a SQL database, but without having to learn another language
# Creates database in SQLite format by default (Can use others as well)
fs = FileSystemStorag... | en | 0.884765 | # Create your models here. # Uses an Object-Relational Mapper (ORM). Similar to a SQL database, but without having to learn another language # Creates database in SQLite format by default (Can use others as well) | 2.755938 | 3 |
backend/apps/listings/migrations/0011_auto_20210902_1847.py | hovedstyret/indok-web | 3 | 6623130 | <reponame>hovedstyret/indok-web<filename>backend/apps/listings/migrations/0011_auto_20210902_1847.py<gh_stars>1-10
# Generated by Django 3.1.8 on 2021-09-02 16:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("listings", "0010_listing_view_count"),
]
... | # Generated by Django 3.1.8 on 2021-09-02 16:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("listings", "0010_listing_view_count"),
]
operations = [
migrations.RenameField(
model_name="listing",
old_name="url",
... | en | 0.78876 | # Generated by Django 3.1.8 on 2021-09-02 16:47 | 1.691612 | 2 |
train.py | tipt0p/periodic_behavior_bn_wd | 1 | 6623131 | import math
import torch
import torch.nn.functional as F
import numpy as np
import os, sys
import time
import tabulate
import data
import training_utils
import nets as models
from parser_train import parser
columns = ["ep", "lr", "tr_loss", "tr_acc", "te_loss", "te_acc", "time"]
def cross_entropy(model, input, target... | import math
import torch
import torch.nn.functional as F
import numpy as np
import os, sys
import time
import tabulate
import data
import training_utils
import nets as models
from parser_train import parser
columns = ["ep", "lr", "tr_loss", "tr_acc", "te_loss", "te_acc", "time"]
def cross_entropy(model, input, target... | en | 0.799565 | # n_trials = 1 # for trial in range(n_trials): ### resuming is modified!!! ### resuming is modified!!! # add extra args for varying names # SI params are convolutions # other params # Warning: due to specific lr schedule, resuming is generally not recommended! # No lr schedule, plz... | 2.43262 | 2 |
simulation/utils_env.py | liaojh1998/cross-modal-concept2robot | 4 | 6623132 | import numpy as np
import pybullet as p
#import matplotlib.pyplot as plt
import os
import torch
import shutil
import torch.autograd as Variable
#import matplotlib as mpl
#from mpl_toolkits.mplot3d import Axes3D
def get_view(opt):
def getview (width=600, height=600, look=[-0.05, -0.3, 0.0], dist=0.25, direct=[0.0,... | import numpy as np
import pybullet as p
#import matplotlib.pyplot as plt
import os
import torch
import shutil
import torch.autograd as Variable
#import matplotlib as mpl
#from mpl_toolkits.mplot3d import Axes3D
def get_view(opt):
def getview (width=600, height=600, look=[-0.05, -0.3, 0.0], dist=0.25, direct=[0.0,... | en | 0.556801 | #import matplotlib.pyplot as plt #import matplotlib as mpl #from mpl_toolkits.mplot3d import Axes3D # TODO: Use config # dist = params[5] :param gripperOpen: 1 represents open, 0 represents close :return: the gripperPos Copies the parameters from source network (x) to target network (y) using the below update y... | 2.19006 | 2 |
order/migrations/0002_auto_20210311_1913.py | Habeebhassan/zarawa_express | 0 | 6623133 | # Generated by Django 3.1.7 on 2021-03-11 19:13
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('order', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='order',
o... | # Generated by Django 3.1.7 on 2021-03-11 19:13
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('order', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='order',
o... | en | 0.761021 | # Generated by Django 3.1.7 on 2021-03-11 19:13 | 1.745815 | 2 |
scripts/test_api.py | sergeyt/pandora | 28 | 6623134 | <filename>scripts/test_api.py
#!/usr/bin/env python
import os
import api
# todo check bad auth cases as separate test cases
def crud(resource):
api.login("system", os.getenv("SYSTEM_PWD"))
data = {
'name': "bob",
'age': 39,
}
print('CREATE')
base = '/api/data/' + resource
... | <filename>scripts/test_api.py
#!/usr/bin/env python
import os
import api
# todo check bad auth cases as separate test cases
def crud(resource):
api.login("system", os.getenv("SYSTEM_PWD"))
data = {
'name': "bob",
'age': 39,
}
print('CREATE')
base = '/api/data/' + resource
... | en | 0.407662 | #!/usr/bin/env python # todo check bad auth cases as separate test cases {{ data(func: eq(name, "bob")) @filter(has({0})) {{ uid name age }} }} | 2.596708 | 3 |
src/ds/01_array.py | burhanuddinbhopalwala/py-ds-algo | 0 | 6623135 | # * Mathematical Algorithm - Lucky number
| # * Mathematical Algorithm - Lucky number
| en | 0.453034 | # * Mathematical Algorithm - Lucky number | 1.2719 | 1 |
protoseg/filters/torch_cade.py | chriamue/protoseg | 0 | 6623136 | <filename>protoseg/filters/torch_cade.py
import numpy as np
import cv2
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as multiprocessing
from torch.utils import data
cade = None
def torch_cade(img, num_angles=8, distance=5, epochs=2, background_min=0, background_max=1... | <filename>protoseg/filters/torch_cade.py
import numpy as np
import cv2
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as multiprocessing
from torch.utils import data
cade = None
def torch_cade(img, num_angles=8, distance=5, epochs=2, background_min=0, background_max=1... | en | 0.556009 | #out = self.layer3(out) # Forward pass # Backward and optimize | 2.720548 | 3 |
modules/model_alignment.py | HHeracles/SEGR | 0 | 6623137 | import torch
import torch.nn as nn
from fastai.vision import *
from modules.model import Model, _default_tfmer_cfg
class BaseAlignment(Model):
def __init__(self, config):
super().__init__(config)
d_model = ifnone(config.model_alignment_d_model, _default_tfmer_cfg['d_model'])
self.loss_wei... | import torch
import torch.nn as nn
from fastai.vision import *
from modules.model import Model, _default_tfmer_cfg
class BaseAlignment(Model):
def __init__(self, config):
super().__init__(config)
d_model = ifnone(config.model_alignment_d_model, _default_tfmer_cfg['d_model'])
self.loss_wei... | en | 0.868694 | # additional stop token Args: l_feature: (N, T, E) where T is length, N is batch size and d is dim of model v_feature: (N, T, E) shape the same as l_feature l_lengths: (N,) v_lengths: (N,) # (N, T, C) #def __init__(self, in_planes, planes, stride=1): # SE layers # Use nn... | 2.459755 | 2 |
openexplorer_old/tools/quench/__init__.py | uibcdf/PELE-OpenMM | 0 | 6623138 | from .l_bfgs import L_BFGS
from .fire import FIRE
from .gradient_descent import GradientDescent
| from .l_bfgs import L_BFGS
from .fire import FIRE
from .gradient_descent import GradientDescent
| none | 1 | 0.995036 | 1 | |
Python/042.py | joonion/Project-Euler | 0 | 6623139 | <reponame>joonion/Project-Euler
from math import floor, sqrt
def is_triangle(word):
s = 0
for i in range(len(word)):
s += ord(word[i]) - ord('A') + 1
n = 8 * s + 1
if n == floor(sqrt(n)) ** 2:
return True
else:
return False
def solve(words):
count = 0
for i in r... | from math import floor, sqrt
def is_triangle(word):
s = 0
for i in range(len(word)):
s += ord(word[i]) - ord('A') + 1
n = 8 * s + 1
if n == floor(sqrt(n)) ** 2:
return True
else:
return False
def solve(words):
count = 0
for i in range(len(words)):
if is_... | none | 1 | 3.66104 | 4 | |
pci_reset.py | RightHandRobotics/linux-bus-reset-tools | 1 | 6623140 | #!/usr/bin/python
"""pci_reset - does an unbind/bind of an entire device"""
import sys
import argparse
import os
from os.path import realpath
from systools import sleep_with_countdown, lspci, lspci_lookup, bind, unbind
if __name__ == "__main__":
## let's restrict ourselves to USB controllers for now...
# 00:1... | #!/usr/bin/python
"""pci_reset - does an unbind/bind of an entire device"""
import sys
import argparse
import os
from os.path import realpath
from systools import sleep_with_countdown, lspci, lspci_lookup, bind, unbind
if __name__ == "__main__":
## let's restrict ourselves to USB controllers for now...
# 00:1... | en | 0.657759 | #!/usr/bin/python pci_reset - does an unbind/bind of an entire device ## let's restrict ourselves to USB controllers for now... # 00:14.0 USB controller: Intel Corporation Wildcat Point-LP USB xHCI Controller (rev 03) # 00:1d.0 USB controller: Intel Corporation Wildcat Point-LP USB EHCI Controller (rev 03) # UHCI: USB ... | 2.568166 | 3 |
python/src/wslink/wslinktypes.py | yasushi-saito/wslink | 0 | 6623141 | from typing import Dict, List, Optional, TypedDict
from wslink.websocket import ServerProtocol
class ServerConfig(TypedDict, total=False):
# The network interface to bind to. If None,
# bind to all interfaces.
host: Optional[str]
# HTTP port to listen to.
port: int
# Idle shutdown timeout, in... | from typing import Dict, List, Optional, TypedDict
from wslink.websocket import ServerProtocol
class ServerConfig(TypedDict, total=False):
# The network interface to bind to. If None,
# bind to all interfaces.
host: Optional[str]
# HTTP port to listen to.
port: int
# Idle shutdown timeout, in... | en | 0.780991 | # The network interface to bind to. If None, # bind to all interfaces. # HTTP port to listen to. # Idle shutdown timeout, in seconds. # websocket routes. # static file serving routes | 2.497462 | 2 |
03_For/Step10/yj.py | StudyForCoding/BEAKJOON | 0 | 6623142 | a = int(input())
for i in range(1,a+1):
print(' '*(a-i)+'*'*i) | a = int(input())
for i in range(1,a+1):
print(' '*(a-i)+'*'*i) | none | 1 | 3.397409 | 3 | |
applications/mupio/migrations/0004_auto_20210721_0338.py | PEM-Humboldt/visor-geografico-I2d-backend | 0 | 6623143 | <filename>applications/mupio/migrations/0004_auto_20210721_0338.py
# Generated by Django 3.1.7 on 2021-07-21 03:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mupio', '0003_delete_mpiopolitico'),
]
operations = [
migrations.CreateMo... | <filename>applications/mupio/migrations/0004_auto_20210721_0338.py
# Generated by Django 3.1.7 on 2021-07-21 03:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mupio', '0003_delete_mpiopolitico'),
]
operations = [
migrations.CreateMo... | en | 0.802675 | # Generated by Django 3.1.7 on 2021-07-21 03:38 | 1.648416 | 2 |
hw1/generate_dagger_comparison_plot.py | Khodeir/homework | 0 | 6623144 | <reponame>Khodeir/homework
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from glob import glob
import pickle
import numpy as np
import re
num_re = re.compile(r'(\d+)[^0-9]*$')
def get_last_num_in_str(path):
match = num_re.search(path)
return... | import matplotlib
matplotlib.use('Agg')
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from glob import glob
import pickle
import numpy as np
import re
num_re = re.compile(r'(\d+)[^0-9]*$')
def get_last_num_in_str(path):
match = num_re.search(path)
return int(match.group(1)) if mat... | none | 1 | 2.153113 | 2 | |
src/utils/program3/values/value_getter.py | amasiukevich/InterpreterNew | 0 | 6623145 | from .value import Value
class ValueGetter(Value):
def __init__(self, base_getters=[]):
self.base_getters = base_getters
def __str__(self):
if self.get_num_base_getters() == 1:
return f"{self.base_getters[0]}"
else:
try:
return ".".join([str... | from .value import Value
class ValueGetter(Value):
def __init__(self, base_getters=[]):
self.base_getters = base_getters
def __str__(self):
if self.get_num_base_getters() == 1:
return f"{self.base_getters[0]}"
else:
try:
return ".".join([str... | none | 1 | 3.025864 | 3 | |
Python_3/Jupyter/test_signals.py | waynegm/OpendTect-External-Attributes | 22 | 6623146 | #
# Python Test Signal Library
#
# Copyright (C) 2018 <NAME> All rights reserved.
#
# This file may be used under the terms of the MIT License
#
# Author: <NAME>
# Date: March, 2018
#
import numpy as np
import scipy.signal as sig
def make_random_signal(nsamp):
"""Make a single trace with random reflectivity
... | #
# Python Test Signal Library
#
# Copyright (C) 2018 <NAME> All rights reserved.
#
# This file may be used under the terms of the MIT License
#
# Author: <NAME>
# Date: March, 2018
#
import numpy as np
import scipy.signal as sig
def make_random_signal(nsamp):
"""Make a single trace with random reflectivity
... | en | 0.838556 | # # Python Test Signal Library # # Copyright (C) 2018 <NAME> All rights reserved. # # This file may be used under the terms of the MIT License # # Author: <NAME> # Date: March, 2018 # Make a single trace with random reflectivity A random reflectivity trace is convolved with a zero phase ricker wavelet Args:... | 2.984926 | 3 |
index.py | the-dean7/python001 | 1 | 6623147 | num=1
num=2
num=30
num=4
num=5
| num=1
num=2
num=30
num=4
num=5
| none | 1 | 1.518163 | 2 | |
bimmer_connected/vehicle/vehicle_status.py | m1n3rva/bimmer_connected | 39 | 6623148 | """Models the state of a vehicle."""
import datetime
import logging
from typing import TYPE_CHECKING, Dict, List, Optional
from bimmer_connected.utils import deprecated
from bimmer_connected.vehicle.models import GPSPosition, ValueWithUnit
if TYPE_CHECKING:
from bimmer_connected.vehicle import MyBMWVehicle
f... | """Models the state of a vehicle."""
import datetime
import logging
from typing import TYPE_CHECKING, Dict, List, Optional
from bimmer_connected.utils import deprecated
from bimmer_connected.vehicle.models import GPSPosition, ValueWithUnit
if TYPE_CHECKING:
from bimmer_connected.vehicle import MyBMWVehicle
f... | en | 0.467024 | Models the state of a vehicle. # pylint: disable=too-many-public-methods Models the status of a vehicle. # pylint: disable=unused-argument Constructor. # type: ignore[misc] # pylint:disable=missing-function-docstring # type: ignore[misc] # pylint:disable=missing-function-docstring # type: ignore[misc] # pylint:disable=... | 2.493999 | 2 |
ckanext/spatial/nongeos_plugin.py | geosolutions-it/ckanext-spatial-cerco | 1 | 6623149 | <reponame>geosolutions-it/ckanext-spatial-cerco<filename>ckanext/spatial/nongeos_plugin.py<gh_stars>1-10
import os
from logging import getLogger
from pylons.i18n import _
from genshi.input import HTML
from genshi.filters import Transformer
import ckan.lib.helpers as h
from ckan.lib.helpers import json
from ckan.plug... | import os
from logging import getLogger
from pylons.i18n import _
from genshi.input import HTML
from genshi.filters import Transformer
import ckan.lib.helpers as h
from ckan.lib.helpers import json
from ckan.plugins import implements, SingletonPlugin
from ckan.plugins import IRoutes, IConfigurer
from ckan.plugins im... | none | 1 | 1.85811 | 2 | |
tests/tools/add_regression_case.py | regardscitoyens/senapy | 6 | 6623150 | <gh_stars>1-10
import sys
import os
import requests
if len(sys.argv) != 3:
print('usage: python add_regression_case.py <dosleg_url> <new_regression_directory>')
sys.exit()
url = sys.argv[1]
output_directory = sys.argv[2]
if not os.path.exists(output_directory):
os.makedirs(output_directory)
with open(os... | import sys
import os
import requests
if len(sys.argv) != 3:
print('usage: python add_regression_case.py <dosleg_url> <new_regression_directory>')
sys.exit()
url = sys.argv[1]
output_directory = sys.argv[2]
if not os.path.exists(output_directory):
os.makedirs(output_directory)
with open(os.path.join(outp... | none | 1 | 2.746503 | 3 |