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 |
|---|---|---|---|---|---|---|---|---|---|---|
virtual/lib/python3.8/site-packages/dns/zonefile.py | Lenus254/personal_blog | 1 | 6200 | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and ... | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and ... | en | 0.806838 | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and t... | 1.76395 | 2 |
swift/common/daemon.py | fossabot/swift-1 | 0 | 6201 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | en | 0.81704 | # Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree... | 2.320398 | 2 |
backend/resource_files_sample.py | Bhaskers-Blu-Org1/multicloud-incident-response-navigator | 0 | 6202 | import resource_files
resources = resource_files.ResourceFiles()
# sample use case of getting yamls
print(resources.get_yaml("Pod", "jumpy-shark-gbapp-frontend-844fdccf55-ggkbf", "default", "mycluster"))
# sample use case of getting events
print(resources.get_events('mycluster','default','78abd8c9-ac06-11e9-b68f-0e7... | import resource_files
resources = resource_files.ResourceFiles()
# sample use case of getting yamls
print(resources.get_yaml("Pod", "jumpy-shark-gbapp-frontend-844fdccf55-ggkbf", "default", "mycluster"))
# sample use case of getting events
print(resources.get_events('mycluster','default','78abd8c9-ac06-11e9-b68f-0e7... | en | 0.883687 | # sample use case of getting yamls # sample use case of getting events # sample use case of getting describe info | 2.053625 | 2 |
backend/api/v1/auth_module/auth_api.py | aroraenterprise/projecteos | 0 | 6203 | """
Project: flask-rest
Author: <NAME>
Description: Handle auth endpoints such as auth/signup, auth/login
"""
from api.v1 import make_json_ok_response, SageController, SageMethod
from api.v1.fundamentals import helper
from .auth_controller import AuthController
def sage_auth_signup_function(self, resource, **kwargs):... | """
Project: flask-rest
Author: <NAME>
Description: Handle auth endpoints such as auth/signup, auth/login
"""
from api.v1 import make_json_ok_response, SageController, SageMethod
from api.v1.fundamentals import helper
from .auth_controller import AuthController
def sage_auth_signup_function(self, resource, **kwargs):... | en | 0.885016 | Project: flask-rest Author: <NAME> Description: Handle auth endpoints such as auth/signup, auth/login # user has been created # save to get a key for the user # not successful # this holds the error message # this holds accesskey and refresh token # not successful # this holds the error message # this holds the refresh... | 2.774039 | 3 |
tests/QuantumToolboxIntegration/test_singleQubitOpenDynamics.py | AngsarM/QuanGuru | 9 | 6204 | import random as rn
import numpy as np
# open system dynamics of a qubit and compare numerical results with the analytical calculations
# NOTE these are also TUTORIALS of the library, so see the Tutorials for what these are doing and analytical
# calculations.
# currently includes 2 cases: (i) decay only, and (ii) un... | import random as rn
import numpy as np
# open system dynamics of a qubit and compare numerical results with the analytical calculations
# NOTE these are also TUTORIALS of the library, so see the Tutorials for what these are doing and analytical
# calculations.
# currently includes 2 cases: (i) decay only, and (ii) un... | en | 0.924225 | # open system dynamics of a qubit and compare numerical results with the analytical calculations # NOTE these are also TUTORIALS of the library, so see the Tutorials for what these are doing and analytical # calculations. # currently includes 2 cases: (i) decay only, and (ii) unitary evolution by calling Liouville meth... | 2.742996 | 3 |
QuGraphy/state.py | Mohamed-ShehabEldin/QuGraphy | 0 | 6205 | <reponame>Mohamed-ShehabEldin/QuGraphy
#this file will contain function that related to vector state
from .density import * #we may use some functions from them and dependencies
def row2col(vec):
if np.ndim(vec)==1:
col=[]
for element in vec:
col.append([element])
return co... | #this file will contain function that related to vector state
from .density import * #we may use some functions from them and dependencies
def row2col(vec):
if np.ndim(vec)==1:
col=[]
for element in vec:
col.append([element])
return col
else:
return vec
def che... | en | 0.900594 | #this file will contain function that related to vector state #we may use some functions from them and dependencies | 3.194385 | 3 |
uncoverml/metadata_profiler.py | GeoscienceAustralia/uncoverml | 34 | 6206 | <filename>uncoverml/metadata_profiler.py
#! /usr/bin/env python
"""
Description:
Gather Metadata for the uncover-ml prediction output results:
Reference: email 2019-05-24
Overview
Creator: (person who generated the model)
Model;
Name:
Type and date:
Algorithm:
Extent: Lat/long - location on Austral... | <filename>uncoverml/metadata_profiler.py
#! /usr/bin/env python
"""
Description:
Gather Metadata for the uncover-ml prediction output results:
Reference: email 2019-05-24
Overview
Creator: (person who generated the model)
Model;
Name:
Type and date:
Algorithm:
Extent: Lat/long - location on Austral... | en | 0.719117 | #! /usr/bin/env python Description: Gather Metadata for the uncover-ml prediction output results: Reference: email 2019-05-24 Overview Creator: (person who generated the model) Model; Name: Type and date: Algorithm: Extent: Lat/long - location on Australia map? SB Notes: None of the above is requi... | 2.313313 | 2 |
testjpkg/jsonify/hij.py | thisisishara/test_pypi_cli | 0 | 6207 | print("hiiiiiiiiiiiiiiiix")
def sayhi():
print("2nd pkg said hi")
| print("hiiiiiiiiiiiiiiiix")
def sayhi():
print("2nd pkg said hi")
| none | 1 | 2.119674 | 2 | |
asv_bench/benchmarks/algorithms.py | raspbian-packages/pandas | 0 | 6208 | <reponame>raspbian-packages/pandas<filename>asv_bench/benchmarks/algorithms.py
import numpy as np
import pandas as pd
from pandas.util import testing as tm
class algorithm(object):
goal_time = 0.2
def setup(self):
N = 100000
self.int_unique = pd.Int64Index(np.arange(N * 5))
# cache i... | import numpy as np
import pandas as pd
from pandas.util import testing as tm
class algorithm(object):
goal_time = 0.2
def setup(self):
N = 100000
self.int_unique = pd.Int64Index(np.arange(N * 5))
# cache is_unique
self.int_unique.is_unique
self.int = pd.Int64Index(np... | en | 0.365514 | # cache is_unique # Convenience naming. | 2.59367 | 3 |
RMtools_1D/do_RMsynth_1D.py | lh-astro/RM-Tools | 0 | 6209 | #!/usr/bin/env python
#=============================================================================#
# #
# NAME: do_RMsynth_1D.py #
# ... | #!/usr/bin/env python
#=============================================================================#
# #
# NAME: do_RMsynth_1D.py #
# ... | en | 0.610386 | #!/usr/bin/env python #=============================================================================# # # # NAME: do_RMsynth_1D.py # # ... | 1.667493 | 2 |
cogdl/modules/conv/__init__.py | awesome-archive/cogdl | 8 | 6210 | from .message_passing import MessagePassing
from .gcn_conv import GCNConv
from .gat_conv import GATConv
from .se_layer import SELayer
from .aggregator import Meanaggregator
from .maggregator import meanaggr
__all__ = [
'MessagePassing',
'GCNConv',
'GATConv',
'SELayer',
'Meanaggregator'
]
| from .message_passing import MessagePassing
from .gcn_conv import GCNConv
from .gat_conv import GATConv
from .se_layer import SELayer
from .aggregator import Meanaggregator
from .maggregator import meanaggr
__all__ = [
'MessagePassing',
'GCNConv',
'GATConv',
'SELayer',
'Meanaggregator'
]
| none | 1 | 1.087383 | 1 | |
netket/utils/jax.py | gpescia/MyNetKet | 1 | 6211 | # Copyright 2021 The NetKet 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 applicable ... | # Copyright 2021 The NetKet 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 applicable ... | en | 0.817855 | # Copyright 2021 The NetKet 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 applicable ... | 2.312582 | 2 |
geetools/batch/featurecollection.py | Kungreye/gee_tools | 0 | 6212 | # coding=utf-8
import ee
from . import utils
import json
import csv
from .. import tools
def fromShapefile(filename, crs=None, start=None, end=None):
""" Convert an ESRI file (.shp and .dbf must be present) to a
ee.FeatureCollection
At the moment only works for shapes with less than 1000 records and does... | # coding=utf-8
import ee
from . import utils
import json
import csv
from .. import tools
def fromShapefile(filename, crs=None, start=None, end=None):
""" Convert an ESRI file (.shp and .dbf must be present) to a
ee.FeatureCollection
At the moment only works for shapes with less than 1000 records and does... | en | 0.765167 | # coding=utf-8 Convert an ESRI file (.shp and .dbf must be present) to a ee.FeatureCollection At the moment only works for shapes with less than 1000 records and doesn't handle complex shapes. :param filename: the name of the filename. If the shape is not in the same path than the script, spec... | 2.991338 | 3 |
index.py | extwiii/Rock-paper-scissors-lizard-Spock | 1 | 6213 | # Rock-paper-scissors-lizard-Spock template
# The key idea of this program is to equate the strings
# "rock", "paper", "scissors", "lizard", "Spock" to numbers
# as follows:
#
# 0 - rock
# 1 - Spock
# 2 - paper
# 3 - lizard
# 4 - scissors
import random
def name_to_number(name):
if name == "rock":
return ... | # Rock-paper-scissors-lizard-Spock template
# The key idea of this program is to equate the strings
# "rock", "paper", "scissors", "lizard", "Spock" to numbers
# as follows:
#
# 0 - rock
# 1 - Spock
# 2 - paper
# 3 - lizard
# 4 - scissors
import random
def name_to_number(name):
if name == "rock":
return ... | en | 0.791939 | # Rock-paper-scissors-lizard-Spock template # The key idea of this program is to equate the strings # "rock", "paper", "scissors", "lizard", "Spock" to numbers # as follows: # # 0 - rock # 1 - Spock # 2 - paper # 3 - lizard # 4 - scissors | 3.999743 | 4 |
libs/clustering/ensembles/utils.py | greenelab/phenoplier | 3 | 6214 | """
Contains functions to generate and combine a clustering ensemble.
"""
import numpy as np
import pandas as pd
from sklearn.metrics import pairwise_distances
from sklearn.metrics import adjusted_rand_score as ari
from sklearn.metrics import adjusted_mutual_info_score as ami
from sklearn.metrics import normalized_mutu... | """
Contains functions to generate and combine a clustering ensemble.
"""
import numpy as np
import pandas as pd
from sklearn.metrics import pairwise_distances
from sklearn.metrics import adjusted_rand_score as ari
from sklearn.metrics import adjusted_mutual_info_score as ami
from sklearn.metrics import normalized_mutu... | en | 0.781403 | Contains functions to generate and combine a clustering ensemble. It generates an ensemble from the data given a set of clusterers (a clusterer is an instance of a clustering algorithm with a fixed set of parameters). Args: data: A numpy array, pandas dataframe, or any other structure s... | 3.240615 | 3 |
backend/chart/application/service/employees.py | toshi-click/chart_app | 0 | 6215 | import logging
from django.db import transaction, connection
from django.utils import timezone
from django.utils.timezone import localtime
from chart.application.enums.department_type import DepartmentType
from chart.application.enums.gender_type import GenderType
from chart.application.service.app_logic_base import ... | import logging
from django.db import transaction, connection
from django.utils import timezone
from django.utils.timezone import localtime
from chart.application.enums.department_type import DepartmentType
from chart.application.enums.gender_type import GenderType
from chart.application.service.app_logic_base import ... | ja | 0.999724 | employeesテーブルを操作するクラスです。 Employeesを作成する # データを登録する Departmentsを作成する # データをすべて削除する # ForeignKeyが指定されているためdeleteコマンドを実行する # データを登録する Employeesを更新する # filterによる絞込を行う # gt:...より大きい(>),lt:...より小さい(<)になる # データを更新する # filterによる絞込を行う # gte:...以上(>=),lte:...以下(<=)になる # データを更新する Employeesを検索する # テーブル名__項目名で指定するとINNER JOINになる # Q... | 2.037254 | 2 |
DataQualityTester/views/pages.py | pwyf/data-quality-tester | 0 | 6216 | from flask import render_template
def home():
return render_template('upload.html')
def about():
return render_template('about.html')
| from flask import render_template
def home():
return render_template('upload.html')
def about():
return render_template('about.html')
| none | 1 | 1.955162 | 2 | |
hastakayit_gui.py | roselight/Image-Recognition-with-OpenCv | 2 | 6217 | <reponame>roselight/Image-Recognition-with-OpenCv<filename>hastakayit_gui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\hastakayit_gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWid... | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\hastakayit_gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import mysql.connector
from PyQt5.QtWidgets import QMessageBox,QWidget,Q... | tr | 0.681174 | # -*- coding: utf-8 -*- # Form implementation generated from reading ui file '.\hastakayit_gui.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! # Veritabanı bağlantısı için sql cümleciği oluşturuldu. # k_ad/k_sfire lineedit'ten alınan verileri sorguya gönderir. | 1.846514 | 2 |
.travis/manage_daily_builds.py | loonwerks/AGREE | 5 | 6218 | <filename>.travis/manage_daily_builds.py<gh_stars>1-10
#!/usr/bin/env python3
'''
Copyright (c) 2021, Collins Aerospace.
Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA).
Permission is hereby granted, free of charge, to any person obtaining a copy of this data,
including any softwa... | <filename>.travis/manage_daily_builds.py<gh_stars>1-10
#!/usr/bin/env python3
'''
Copyright (c) 2021, Collins Aerospace.
Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA).
Permission is hereby granted, free of charge, to any person obtaining a copy of this data,
including any softwa... | en | 0.803034 | #!/usr/bin/env python3 Copyright (c) 2021, Collins Aerospace. Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA). Permission is hereby granted, free of charge, to any person obtaining a copy of this data, including any software or models in source or binary form, as well as any drawin... | 1.740999 | 2 |
tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py | KaihuiLiang/ParlAI | 0 | 6219 | <filename>tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py
#!/usr/bin/env python3
# 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.
"""
Test components ... | <filename>tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py
#!/usr/bin/env python3
# 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.
"""
Test components ... | en | 0.861465 | #!/usr/bin/env python3 # 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. Test components of specific crowdsourcing tasks. Test the analysis code for the static turn annotations task. Test compili... | 2.486348 | 2 |
scripts/selectors.py | bartongroup/slivka-bio | 0 | 6220 | def example_selector(*args, **kwargs): return "default"
| def example_selector(*args, **kwargs): return "default"
| none | 1 | 1.422666 | 1 | |
applied_python/applied_python/lib/python2.7/site-packages/ansible/modules/extras/messaging/rabbitmq_plugin.py | mith1979/ansible_automation | 1 | 6221 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chatham Financial <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, ... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chatham Financial <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, ... | en | 0.725499 | #!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, Chatham Financial <<EMAIL>> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, o... | 1.478076 | 1 |
vitrage/datasources/static/driver.py | HoonMinJeongUm/Hunmin-vitrage | 0 | 6222 | # Copyright 2016 - Nokia, ZTE
#
# 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... | # Copyright 2016 - Nokia, ZTE
#
# 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... | en | 0.719184 | # Copyright 2016 - Nokia, ZTE # # 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... | 1.711127 | 2 |
napari/layers/shapes/mesh.py | marshuang80/napari | 0 | 6223 | <reponame>marshuang80/napari
import numpy as np
class Mesh:
"""Contains meshses of shapes that will ultimately get rendered.
Attributes
----------
vertices : np.ndarray
Qx2 array of vertices of all triangles for shapes including edges and
faces
vertices_centers : np.ndarray
... | import numpy as np
class Mesh:
"""Contains meshses of shapes that will ultimately get rendered.
Attributes
----------
vertices : np.ndarray
Qx2 array of vertices of all triangles for shapes including edges and
faces
vertices_centers : np.ndarray
Qx2 array of centers of ... | en | 0.699898 | Contains meshses of shapes that will ultimately get rendered. Attributes ---------- vertices : np.ndarray Qx2 array of vertices of all triangles for shapes including edges and faces vertices_centers : np.ndarray Qx2 array of centers of vertices of triangles for shapes. For ve... | 2.999542 | 3 |
python/helpers.py | cdacos/astrophysics_with_a_pc | 0 | 6224 | <gh_stars>0
import sys
def start_parameter(text, i):
if len(sys.argv) > i:
print('{0}{1}'.format(text, sys.argv[i]))
return float(sys.argv[i])
else:
return float(raw_input(text))
| import sys
def start_parameter(text, i):
if len(sys.argv) > i:
print('{0}{1}'.format(text, sys.argv[i]))
return float(sys.argv[i])
else:
return float(raw_input(text)) | none | 1 | 3.094277 | 3 | |
configs/docker-ubuntu-img/para.py | MarioCarrilloA/stx-packaging | 1 | 6225 | <reponame>MarioCarrilloA/stx-packaging
#!/usr/bin/python3
# vim:se tw=0 sts=4 ts=4 et ai:
"""
Copyright © 2014 <NAME>
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... | #!/usr/bin/python3
# vim:se tw=0 sts=4 ts=4 et ai:
"""
Copyright © 2014 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, ... | de | 0.291272 | #!/usr/bin/python3 # vim:se tw=0 sts=4 ts=4 et ai: Copyright © 2014 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy... | 2.047773 | 2 |
build/lib/jet_django/views/model.py | lukejamison/jet-dasboard | 193 | 6226 | from django.core.exceptions import NON_FIELD_ERRORS
from rest_framework import status, viewsets, serializers
from rest_framework.decorators import list_route
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer
from jet_django.filters.model_aggregate import AggregateFilte... | from django.core.exceptions import NON_FIELD_ERRORS
from rest_framework import status, viewsets, serializers
from rest_framework.decorators import list_route
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer
from jet_django.filters.model_aggregate import AggregateFilte... | en | 0.717386 | Return the serializer instance that should be used for validating and deserializing input, and for serializing output. | 1.913745 | 2 |
python_minecraft_tut_2021/weatherCraft.py | LeGamermc/ursina_tutorials | 13 | 6227 | """
Weather functions.
"""
from ursina import color, window, time
from nMap import nMap
class Weather:
def __init__(this, rate=1):
this.red = 0
this.green = 200
this.blue = 211
this.darkling = 0
this.rate = rate
this.towardsNight = 1
def setSky(this):
... | """
Weather functions.
"""
from ursina import color, window, time
from nMap import nMap
class Weather:
def __init__(this, rate=1):
this.red = 0
this.green = 200
this.blue = 211
this.darkling = 0
this.rate = rate
this.towardsNight = 1
def setSky(this):
... | en | 0.597576 | Weather functions. | 3.22545 | 3 |
davenetgame/dispatch/dispatcher.py | davefancella/davenetgame | 0 | 6228 | <filename>davenetgame/dispatch/dispatcher.py<gh_stars>0
#!/usr/bin/env python3
'''
Copyright 2016 <NAME>
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/lic... | <filename>davenetgame/dispatch/dispatcher.py<gh_stars>0
#!/usr/bin/env python3
'''
Copyright 2016 <NAME>
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/lic... | en | 0.881547 | #!/usr/bin/env python3 Copyright 2016 <NAME> 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... | 2.434542 | 2 |
account/migrations/0003_customuser_phone_number.py | zenofewords/thebrushstash | 0 | 6229 | <filename>account/migrations/0003_customuser_phone_number.py
# Generated by Django 2.2.7 on 2019-11-17 17:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0002_remove_customuser_full_name'),
]
operations = [
migrations.AddF... | <filename>account/migrations/0003_customuser_phone_number.py
# Generated by Django 2.2.7 on 2019-11-17 17:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0002_remove_customuser_full_name'),
]
operations = [
migrations.AddF... | en | 0.749166 | # Generated by Django 2.2.7 on 2019-11-17 17:19 | 1.577313 | 2 |
03_Estrutura_de_Repeticao/13_potenciacao.py | gabrieldcpadilha/ListaDeExercicios-PythonBrasil | 0 | 6230 | <reponame>gabrieldcpadilha/ListaDeExercicios-PythonBrasil<filename>03_Estrutura_de_Repeticao/13_potenciacao.py
base = int(input('Digite o valor da base: '))
expoente = 0
while expoente <= 0:
expoente = int(input('Digite o valor do expoente: '))
if expoente <= 0:
print('O expoente tem que ser positivo')... | base = int(input('Digite o valor da base: '))
expoente = 0
while expoente <= 0:
expoente = int(input('Digite o valor do expoente: '))
if expoente <= 0:
print('O expoente tem que ser positivo')
potencia = 1
for c in range(1, expoente + 1):
potencia *= base
print(f'{base}^ {expoente} = {potencia}'... | none | 1 | 4.074016 | 4 | |
accounting/accounting/doctype/journal_entry/journal_entry.py | noahjacob/Accounting | 1 | 6231 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import flt
from accounting.accounting.general_ledger import make_gl_e... | # -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import flt
from accounting.accounting.general_ledger import make_gl_entry, make_reve... | en | 0.749033 | # -*- coding: utf-8 -*- # Copyright (c) 2021, <NAME> and contributors # For license information, please see license.txt # cancel gl entry | 2.437701 | 2 |
polls/models.py | mmeooo/test_django | 0 | 6232 | <reponame>mmeooo/test_django<filename>polls/models.py
from django.db import models
# Create your models here.
# 클래스의 기능: 상속
class Question(models.Model): # Table
question_text= models.CharField(max_length= 100) # column, datatype
public_date= models.CharField(max_length= 100)
votes= models.DecimalField(max... | from django.db import models
# Create your models here.
# 클래스의 기능: 상속
class Question(models.Model): # Table
question_text= models.CharField(max_length= 100) # column, datatype
public_date= models.CharField(max_length= 100)
votes= models.DecimalField(max_digits= 20, decimal_places= 10)
# 위의 2개 타입으로 클래스 만들면 ... | ko | 0.960451 | # Create your models here. # 클래스의 기능: 상속 # Table # column, datatype # 위의 2개 타입으로 클래스 만들면 ok # link, string-> CharField, data-> DecimalField # 보통 max_length= 100으로 함 | 2.67658 | 3 |
ipcam/test_snap.py | jack139/HF | 10 | 6233 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,os,time
if len(sys.argv)<2:
print "usage: test_snap.py <check|show>"
sys.exit(2)
kam_cmd=sys.argv[1]
path='/var/data2/snap_store'
a=os.listdir(path)
a.remove('535e1a5c1ecffb2fa372fd7d') # this is a camera not used in HF system
if kam_cmd=='show' or kam_cm... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,os,time
if len(sys.argv)<2:
print "usage: test_snap.py <check|show>"
sys.exit(2)
kam_cmd=sys.argv[1]
path='/var/data2/snap_store'
a=os.listdir(path)
a.remove('535e1a5c1ecffb2fa372fd7d') # this is a camera not used in HF system
if kam_cmd=='show' or kam_cm... | en | 0.761571 | #!/usr/bin/env python # -*- coding: utf-8 -*- # this is a camera not used in HF system | 2.437411 | 2 |
sources/datasets/client_dataset_definitions/client_dataset.py | M4rukku/impact_of_non_iid_data_in_federated_learning | 0 | 6234 | import functools
import gc
from abc import ABC
from sources.datasets.client_dataset_definitions.client_dataset_loaders.client_dataset_loader import ClientDatasetLoader, DatasetComponents
from sources.datasets.client_dataset_definitions.client_dataset_processors.client_dataset_processor import ClientDatasetProcessor
fr... | import functools
import gc
from abc import ABC
from sources.datasets.client_dataset_definitions.client_dataset_loaders.client_dataset_loader import ClientDatasetLoader, DatasetComponents
from sources.datasets.client_dataset_definitions.client_dataset_processors.client_dataset_processor import ClientDatasetProcessor
fr... | en | 0.877038 | Error: Tried to access client Dataset outside of context manager. This might lead to data leaks and bad use of memory. Please wrap the usage of ClientDataset.dataset_x inside a "with statement". Pre-processes each batch of features before being fed to the mode... | 2.357289 | 2 |
src/rmt/kinematics.py | mfrigerio17/robot-model-tools | 2 | 6235 | <reponame>mfrigerio17/robot-model-tools
import logging
import numpy
import kgprim.motions as motions
import kgprim.ct.frommotions as frommotions
import kgprim.ct.repr.mxrepr as mxrepr
import motiondsl.motiondsl as motdsl
logger = logging.getLogger(__name__)
class RobotKinematics:
'''The composition of the consta... | import logging
import numpy
import kgprim.motions as motions
import kgprim.ct.frommotions as frommotions
import kgprim.ct.repr.mxrepr as mxrepr
import motiondsl.motiondsl as motdsl
logger = logging.getLogger(__name__)
class RobotKinematics:
'''The composition of the constant poses and the joint poses of a robot.... | en | 0.889501 | The composition of the constant poses and the joint poses of a robot. This class is a simple aggregation of the geometry model and the joint-poses model. By merging the two, this class have access to the full robot kinematics. Thanks to gr.motions.ConnectedFramesInspector, an arbitrary relative pose ... | 2.299423 | 2 |
awx/main/management/commands/run_dispatcher.py | atr0s/awx | 0 | 6236 | <filename>awx/main/management/commands/run_dispatcher.py
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import logging
from multiprocessing import Process
from django.conf import settings
from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand
from d... | <filename>awx/main/management/commands/run_dispatcher.py
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import logging
from multiprocessing import Process
from django.conf import settings
from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand
from d... | en | 0.924609 | # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # if the parent PID changes, this process has been orphaned # via e.g., segfault or sigkill, we should exit too # It's important to close these because we're _about_ to fork, and we # don't want the forked processes to inherit the open sockets # for the DB and m... | 2.052139 | 2 |
pcdet/utils/box_coder_utils.py | Nuri-benbarka/PCDet | 7 | 6237 | <gh_stars>1-10
import numpy as np
import torch
from . import common_utils
class ResidualCoder(object):
def __init__(self, code_size=7):
super().__init__()
self.code_size = code_size
@staticmethod
def encode_np(boxes, anchors):
"""
:param boxes: (N, 7 + ?) x, y, z, w, l, h,... | import numpy as np
import torch
from . import common_utils
class ResidualCoder(object):
def __init__(self, code_size=7):
super().__init__()
self.code_size = code_size
@staticmethod
def encode_np(boxes, anchors):
"""
:param boxes: (N, 7 + ?) x, y, z, w, l, h, r, custom valu... | en | 0.580676 | :param boxes: (N, 7 + ?) x, y, z, w, l, h, r, custom values, z is the box center in z-axis :param anchors: (N, 7 + ?) :return: # need to convert boxes to z-center format # 4.3 # 1.6 :param box_encodings: (N, 7 + ?) x, y, z, w, l, h, r, custom values, z is the box center in z-axis :param anchors:... | 2.497605 | 2 |
utils/utils.py | jainajinkya/deep_bingham | 0 | 6238 | <reponame>jainajinkya/deep_bingham
""" Utilities for learning pipeline."""
from __future__ import print_function
import copy
import dill
import hashlib
import itertools
import third_party.deep_bingham.bingham_distribution as ms
import math
import numpy as np
import os
import scipy
import scipy.integrate as integrate
im... | """ Utilities for learning pipeline."""
from __future__ import print_function
import copy
import dill
import hashlib
import itertools
import third_party.deep_bingham.bingham_distribution as ms
import math
import numpy as np
import os
import scipy
import scipy.integrate as integrate
import scipy.special
import sys
impor... | en | 0.755976 | Utilities for learning pipeline. Converts roll, yaw, pitch to a quaternion. # roll (z), yaw (y), pitch (x) Method to convert a torch tensor of angles in degree format to radians. Arguments: degree_tensor (torch.Tensor): Tensor consisting of angles in degree format. Returns: radian_tensor (... | 2.611842 | 3 |
cli_ui.py | obatsis/Distributed-NTUA | 0 | 6239 | import requests
import os
from PyInquirer import style_from_dict, Token, prompt
import sys
import utils.config as config
import utils.ends as ends
from utils.colorfy import *
from auto.testing import test_trans
import time
import json
style = style_from_dict({
Token.QuestionMark: '#E91E63 bold',
Token.Selected: '#673... | import requests
import os
from PyInquirer import style_from_dict, Token, prompt
import sys
import utils.config as config
import utils.ends as ends
from utils.colorfy import *
from auto.testing import test_trans
import time
import json
style = style_from_dict({
Token.QuestionMark: '#E91E63 bold',
Token.Selected: '#673... | en | 0.425932 | # print(cyan("Deleting Song: ") + green(response.text.split(" ")[1]) + ) # print(green(response.text)) # print(cyan())) | 2.840058 | 3 |
Contents/scripts/siweighteditor/weight.py | jdrese/SIWeightEditor | 1 | 6240 | <reponame>jdrese/SIWeightEditor<filename>Contents/scripts/siweighteditor/weight.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from maya import mel
from maya import cmds
from . import lang
from . import common
import os
import json
import re
class WeightCopyPaste():
def main(self, skinMeshes, mode='copy', saveName='defa... | # -*- coding: utf-8 -*-
from maya import mel
from maya import cmds
from . import lang
from . import common
import os
import json
import re
class WeightCopyPaste():
def main(self, skinMeshes, mode='copy', saveName='default', method='index', weightFile='auto',
threshold=0.2, engine='maya', t... | ja | 0.999902 | # -*- coding: utf-8 -*- ウェイトデータの保存、読み込み関数 mode→コピーするかペーストするか'copy'or'paste' saveName→ウェイトデータの保存フォルダ名。ツール、モデル名とかで分けたい場合に指定 method→ペーストの仕方,「index」、「nearest」、「barycentric」、「over」 「index」法は、頂点インデックスを使用してウェイトをオブジェクトにマッピングします。マッピング先のオブジェクトと書き出し後のデータのトポロジが同じ場合、これが最も便利な手法です。 「nearest」法は、... | 2.163538 | 2 |
pyConTextNLP/__init__.py | Blulab-Utah/pyConTextPipeline | 1 | 6241 | <filename>pyConTextNLP/__init__.py<gh_stars>1-10
#Copyright 2010 <NAME>
#
#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 ap... | <filename>pyConTextNLP/__init__.py<gh_stars>1-10
#Copyright 2010 <NAME>
#
#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 ap... | en | 0.907826 | #Copyright 2010 <NAME> # #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, software #d... | 2.156769 | 2 |
pypeit/metadata.py | rcooke-ast/PYPIT | 0 | 6242 | """
Provides a class that handles the fits metadata required by PypeIt.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import os
import io
import string
from copy import deepcopy
import datetime
from IPython import embed
import numpy as np
import yaml
fr... | """
Provides a class that handles the fits metadata required by PypeIt.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import os
import io
import string
from copy import deepcopy
import datetime
from IPython import embed
import numpy as np
import yaml
fr... | en | 0.751452 | Provides a class that handles the fits metadata required by PypeIt. .. include common links, assuming primary doc root is up one directory .. include:: ../include/links.rst # TODO: Turn this into a DataContainer # Initially tried to subclass this from astropy.table.Table, but that # proved too difficult. Provides a ta... | 2.387937 | 2 |
aql/aql/main/aql_builtin_tools.py | menify/sandbox | 0 | 6243 | <filename>aql/aql/main/aql_builtin_tools.py<gh_stars>0
import os.path
import shutil
import errno
from aql.nodes import Builder, FileBuilder
from .aql_tools import Tool
__all__ = ( "ExecuteCommand",
"InstallBuilder",
"BuiltinTool",
)
"""
Unique Value - name + type
value
node
node ... | <filename>aql/aql/main/aql_builtin_tools.py<gh_stars>0
import os.path
import shutil
import errno
from aql.nodes import Builder, FileBuilder
from .aql_tools import Tool
__all__ = ( "ExecuteCommand",
"InstallBuilder",
"BuiltinTool",
)
"""
Unique Value - name + type
value
node
node ... | en | 0.240291 | Unique Value - name + type value node node = ExecuteCommand('gcc --help -v') tools.cpp.cxx node = ExecuteCommand( tools.cpp.cxx, '--help -v' ) node = ExecuteMethod( target = my_function ) dir_node = CopyFiles( prog_node, target = dir_name ) dir_node = CopyFilesAs( prog_node, target = dir_name ) dir_node = MoveFile... | 2.225967 | 2 |
cms/test_utils/project/placeholderapp/models.py | stefanw/django-cms | 0 | 6244 | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from cms.models.fields import PlaceholderField
from cms.utils import get_language_from_request
from cms.utils.urlutils import admin_reverse
from hvad.models import TranslatableModel,... | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from cms.models.fields import PlaceholderField
from cms.utils import get_language_from_request
from cms.utils.urlutils import admin_reverse
from hvad.models import TranslatableModel,... | none | 1 | 2.029547 | 2 | |
150-Challenges/Challenges 80 - 87/Challenge 84.py | DGrifferty/Python | 0 | 6245 | # 084
# Ask the user to type in their postcode.Display the first two
# letters in uppercase.
# very simple
print(input('Enter your postcode: ')[0:2].upper()) | # 084
# Ask the user to type in their postcode.Display the first two
# letters in uppercase.
# very simple
print(input('Enter your postcode: ')[0:2].upper()) | en | 0.899117 | # 084 # Ask the user to type in their postcode.Display the first two # letters in uppercase. # very simple | 3.683884 | 4 |
api_youtube.py | OnoArnaldo/PythonApiYoutube | 2 | 6246 | <filename>api_youtube.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import json
import urllib2
import codecs
BASE_DIR = os.path.dirname(__file__)
BASE_URL = 'https://www.googleapis.com/youtube/v3/'
API_CHANNELS = 'channels'
API_PLAYLIST = 'playlistItems'
API_KEY = 'YOUR KEY'
... | <filename>api_youtube.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import json
import urllib2
import codecs
BASE_DIR = os.path.dirname(__file__)
BASE_URL = 'https://www.googleapis.com/youtube/v3/'
API_CHANNELS = 'channels'
API_PLAYLIST = 'playlistItems'
API_KEY = 'YOUR KEY'
... | en | 0.769321 | # -*- coding: utf-8 -*- | 2.955151 | 3 |
python_and_ebpf/train.py | be4r/ssh-miner-detection | 0 | 6247 | <reponame>be4r/ssh-miner-detection
#!/usr/bin/env python3
from sklearn.tree import DecisionTreeClassifier
import pickle
import numpy as np
no = [b'runc:[2:INIT]', b'containerssh-ag', b'apt',b'dpkg']
class model:
def __init__(self):
self.d = DecisionTreeClassifier()
def load(self, filename = 'model.p'):
try:
... | #!/usr/bin/env python3
from sklearn.tree import DecisionTreeClassifier
import pickle
import numpy as np
no = [b'runc:[2:INIT]', b'containerssh-ag', b'apt',b'dpkg']
class model:
def __init__(self):
self.d = DecisionTreeClassifier()
def load(self, filename = 'model.p'):
try:
f = open(filename, 'rb')
self... | en | 0.182735 | #!/usr/bin/env python3 #x1,y1,x2,y2 = train_test_split(x,y,0.05) #classifier.load() #classifier.fit(x,y) #classifier.save() | 2.642231 | 3 |
data/parse_hipp_data.py | slinderman/pyhsmm-spiketrains | 10 | 6248 | import os
import numpy as np
from scipy.io import loadmat
data = loadmat("data/hipp_2dtrack_a/smJun03p2.dat")
N = 49
data = reshape(data, 3, length(data)/3);
data = data';
size(data) % 43799-by-3
fclose(fid);
% sampling time
Ts = 0.0333;
duration = size(data,1) * Ts; % in second
Tmax = data(end, 3);
Tmin = d... | import os
import numpy as np
from scipy.io import loadmat
data = loadmat("data/hipp_2dtrack_a/smJun03p2.dat")
N = 49
data = reshape(data, 3, length(data)/3);
data = data';
size(data) % 43799-by-3
fclose(fid);
% sampling time
Ts = 0.0333;
duration = size(data,1) * Ts; % in second
Tmax = data(end, 3);
Tmin = d... | none | 1 | 2.402127 | 2 | |
repokid/tests/test_roledata.py | tomdev/repokid | 0 | 6249 | # Copyright 2017 Netflix, 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... | # Copyright 2017 Netflix, 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... | en | 0.898847 | # Copyright 2017 Netflix, 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... | 1.747502 | 2 |
DL_Scripts/image_recognition.py | Matnay/KPIT_Deep_Learning | 1 | 6250 | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_download_and_extract()
self._session = tf.Sessio... | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_download_and_extract()
self._session = tf.Sessio... | en | 0.779725 | # copy from # classify_image.py # Creates graph from saved GraphDef. # Creates node ID --> English string lookup. | 2.515037 | 3 |
plugins/grouputils.py | aviskumar/speedo | 0 | 6251 | <filename>plugins/grouputils.py
# Copyright (C) 2020-2021 by TeamSpeed<EMAIL>, < https://github.com/TeamSpeedo >.
#
# This file is part of < https://github.com/TeamSpeedo/FridayUserBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/TeamSpeedo/blob/master/LICENSE >... | <filename>plugins/grouputils.py
# Copyright (C) 2020-2021 by TeamSpeed<EMAIL>, < https://github.com/TeamSpeedo >.
#
# This file is part of < https://github.com/TeamSpeedo/FridayUserBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/TeamSpeedo/blob/master/LICENSE >... | en | 0.252059 | # Copyright (C) 2020-2021 by TeamSpeed<EMAIL>, < https://github.com/TeamSpeedo >. # # This file is part of < https://github.com/TeamSpeedo/FridayUserBot > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/TeamSpeedo/blob/master/LICENSE > # # All rights reserved. <b>Adm... | 1.691951 | 2 |
carberretta/bot/cogs/feeds.py | Nereg/Carberretta | 0 | 6252 | <filename>carberretta/bot/cogs/feeds.py
"""
FEEDS
Handles YouTube and Twitch feed notifications.
"""
import datetime as dt
import discord
import feedparser
from apscheduler.triggers.cron import CronTrigger
from discord.ext import commands
from carberretta import Config
from carberretta.utils import DEFAULT_EMBED_COL... | <filename>carberretta/bot/cogs/feeds.py
"""
FEEDS
Handles YouTube and Twitch feed notifications.
"""
import datetime as dt
import discord
import feedparser
from apscheduler.triggers.cron import CronTrigger
from discord.ext import commands
from carberretta import Config
from carberretta.utils import DEFAULT_EMBED_COL... | en | 0.982319 | FEEDS Handles YouTube and Twitch feed notifications. # We announced this vod already # This is a vod we havent announced # This is a video we already announced # A new video is live and its was not a premiere # This isnt a VOD # We have not seen this premiere before # This premiere is upcoming and not live # The premie... | 2.437315 | 2 |
gdb/proxy.py | abaire/gdb_sniffer | 1 | 6253 | <gh_stars>1-10
"""Provides a GDB logging proxy.
See https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
See https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html
"""
from __future__ import annotations
import logging
import socket
from typing import Optional
from typing import ... | """Provides a GDB logging proxy.
See https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
See https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html
"""
from __future__ import annotations
import logging
import socket
from typing import Optional
from typing import Tuple
from .pa... | en | 0.820905 | Provides a GDB logging proxy. See https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html See https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html GDB Remote Serial Protocol proxy. # RSP uses '}' as an escape character. Escapes are processed in this method # before adding to the re... | 2.279371 | 2 |
pylayers/em/openems/test/Rect_Waveguide.py | usmanwardag/pylayers | 143 | 6254 | <filename>pylayers/em/openems/test/Rect_Waveguide.py<gh_stars>100-1000
from openems.openems import *
# A simple simulation
#
# FDTD Simulation Setting
#
F = FDTD()
F.add(Exc(typ='Sinus',f0=100000))
F.add(BoundaryCond(['PMC','PMC','PEC','PEC','MUR','MUR']))
#
# CSX (Geometry setting)
#
C = CSX()
# The Box is added ... | <filename>pylayers/em/openems/test/Rect_Waveguide.py<gh_stars>100-1000
from openems.openems import *
# A simple simulation
#
# FDTD Simulation Setting
#
F = FDTD()
F.add(Exc(typ='Sinus',f0=100000))
F.add(BoundaryCond(['PMC','PMC','PEC','PEC','MUR','MUR']))
#
# CSX (Geometry setting)
#
C = CSX()
# The Box is added ... | en | 0.322418 | # A simple simulation # # FDTD Simulation Setting # # # CSX (Geometry setting) # # The Box is added as a property #gnd = Matter('gnd') #sphere = Matter('sphere') #patch = Matter('patch') #substrate = Matter('substrate',typ='Ma',Epsilon="3.38",Kappa="0.00046") #cdgsht = Matter('copper',typ='Cs',conductivity="56e6",thick... | 1.84436 | 2 |
DataPreprocessing/_segment_Y.py | vd1371/CBSA | 0 | 6255 | import numpy as np
def segment_Y(Y, **params):
Y_segments = params.get("Y_segments")
Y_quantile = params.get("Y_quantile")
print("segmenting Y")
Y = Y.values.reshape(-1)
Y_quantile = np.quantile(Y, Y_quantile, axis = 0)
bigger_mask = (Y > Y_quantile).copy()
smaller_mask = (Y <= Y_quantile).copy()
Y[bigger_... | import numpy as np
def segment_Y(Y, **params):
Y_segments = params.get("Y_segments")
Y_quantile = params.get("Y_quantile")
print("segmenting Y")
Y = Y.values.reshape(-1)
Y_quantile = np.quantile(Y, Y_quantile, axis = 0)
bigger_mask = (Y > Y_quantile).copy()
smaller_mask = (Y <= Y_quantile).copy()
Y[bigger_... | none | 1 | 2.796045 | 3 | |
WifiEnigma/BattleAI/question.py | Puzzlebox-IMT/Puzzlebox | 0 | 6256 | import mysql.connector
import random
from voice import synthetize_voice, delete_wav
def AllQuestionAI(id_theme):
i = 0
#CONNEXION A LA BDD
conn = mysql.connector.connect(host="localhost",
user="phpmyadmin", password="<PASSWORD>",
datab... | import mysql.connector
import random
from voice import synthetize_voice, delete_wav
def AllQuestionAI(id_theme):
i = 0
#CONNEXION A LA BDD
conn = mysql.connector.connect(host="localhost",
user="phpmyadmin", password="<PASSWORD>",
datab... | fr | 0.353407 | #CONNEXION A LA BDD #EXECUTER LA REQUETE AVEC LA BDD #RECUPERATION DES INFORMATIONS #CONNEXION A LA BDD #EXECUTER LA REQUETE AVEC LA BDD #RECUPERATION DES INFORMATIONS #L'index de la liste commence à zéro, il faut donc décaler d'un le numéro #Tab which stores the query results #RECUPERATION DES TUPLES #This last one is... | 2.705998 | 3 |
toy-amr/flux_functions.py | IanHawke/toy-amr | 5 | 6257 | import numpy
def lax_friedrichs(cons_minus, cons_plus, simulation, tl):
alpha = tl.grid.dx / tl.dt
flux = numpy.zeros_like(cons_minus)
prim_minus, aux_minus = simulation.model.cons2all(cons_minus, tl.prim)
prim_plus, aux_plus = simulation.model.cons2all(cons_plus , tl.prim)
f_minus = simulation.m... | import numpy
def lax_friedrichs(cons_minus, cons_plus, simulation, tl):
alpha = tl.grid.dx / tl.dt
flux = numpy.zeros_like(cons_minus)
prim_minus, aux_minus = simulation.model.cons2all(cons_minus, tl.prim)
prim_plus, aux_plus = simulation.model.cons2all(cons_plus , tl.prim)
f_minus = simulation.m... | none | 1 | 2.197016 | 2 | |
pi/auth.py | vmagamedov/pi | 7 | 6258 | <gh_stars>1-10
import re
import json
import base64
import codecs
import os.path
import asyncio
import subprocess
_PREFIX = 'docker-credential-'
def read_config():
path = os.path.expanduser('~/.docker/config.json')
if not os.path.exists(path):
return {}
with codecs.open(path, encoding='utf-8') as... | import re
import json
import base64
import codecs
import os.path
import asyncio
import subprocess
_PREFIX = 'docker-credential-'
def read_config():
path = os.path.expanduser('~/.docker/config.json')
if not os.path.exists(path):
return {}
with codecs.open(path, encoding='utf-8') as f:
jso... | none | 1 | 2.212778 | 2 | |
etl/transform.py | ACWI-SOGW/ngwmn_monitoring_locations_etl | 1 | 6259 | <filename>etl/transform.py
"""
Transform the data into a form that
works with the WELL_REGISTRY_STG table.
"""
import re
def mapping_factory(mapping):
def map_func(key):
if key is not None:
ora_val = mapping.get(key.lower())
else:
ora_val = None
return ora_val
r... | <filename>etl/transform.py
"""
Transform the data into a form that
works with the WELL_REGISTRY_STG table.
"""
import re
def mapping_factory(mapping):
def map_func(key):
if key is not None:
ora_val = mapping.get(key.lower())
else:
ora_val = None
return ora_val
r... | en | 0.824721 | Transform the data into a form that works with the WELL_REGISTRY_STG table. Map the fields from the API JSON response to the fields in the WELL_REGISTRY_STG table with appropriate foreign key values. # fix missing fractions of a second | 2.874845 | 3 |
django_reporter_pro/config/model_configs.py | shamilison/django-reporter-pro | 0 | 6260 | <reponame>shamilison/django-reporter-pro
# Created by shamilsakib at 04/10/20
BASE_MODEL = None | # Created by shamilsakib at 04/10/20
BASE_MODEL = None | en | 0.945204 | # Created by shamilsakib at 04/10/20 | 0.942157 | 1 |
DPSparkImplementations/paf_kernels.py | TEAlab/DPSpark | 0 | 6261 | <filename>DPSparkImplementations/paf_kernels.py
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright (c) 2019 Tealab@SBU"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import numpy as np
import numba as nb
'''
Iterative kernels
'''
def u... | <filename>DPSparkImplementations/paf_kernels.py
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright (c) 2019 Tealab@SBU"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import numpy as np
import numba as nb
'''
Iterative kernels
'''
def u... | en | 0.85068 | Iterative kernels # For testing purposes, rather than passing f_matrix_broadcast, we call this function | 2.300359 | 2 |
terrakg/rates.py | terrapain/terrakg | 0 | 6262 | from terra_sdk.exceptions import LCDResponseError
from terrakg import logger
# Logging
from terrakg.client import ClientContainer
logger = logger.get_logger(__name__)
class Rates:
"""
Access the most recent rates.
"""
def __init__(self, client: ClientContainer):
self.client = client
de... | from terra_sdk.exceptions import LCDResponseError
from terrakg import logger
# Logging
from terrakg.client import ClientContainer
logger = logger.get_logger(__name__)
class Rates:
"""
Access the most recent rates.
"""
def __init__(self, client: ClientContainer):
self.client = client
de... | en | 0.848567 | # Logging Access the most recent rates. Returns the price for `amount` of the token `pair` (exchange is included in pair). Set `reverse` to true to get the inverse price. | 2.479177 | 2 |
src/tracking_module.py | HonzaKlicpera/Effective-footage-processing-Blender-add-on | 1 | 6263 | import bpy
import os, glob
from pathlib import Path
from enum import Enum
from abc import ABC, abstractmethod
import csv
from . import keying_module
def export_tracking_data(self, context):
clip = context.space_data.clip
clip_name = os.path.splitext(clip.name)[0]
tracker_name = context.scene.tracking_loca... | import bpy
import os, glob
from pathlib import Path
from enum import Enum
from abc import ABC, abstractmethod
import csv
from . import keying_module
def export_tracking_data(self, context):
clip = context.space_data.clip
clip_name = os.path.splitext(clip.name)[0]
tracker_name = context.scene.tracking_loca... | pt | 0.095211 | #---------------------------------------- # PROPERTIES #---------------------------------------- | 2.4095 | 2 |
nodes/2.x/python/View.ViewTemplate.py | andydandy74/ClockworkForDynamo | 147 | 6264 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
def GetViewTemplate(view):
if not view: return None
elif hasattr(view, "ViewTemplateId"):
if view.ViewTemplateId.IntegerValue == -1: return None
else: return view.Document.GetElement(view.ViewTemplateId)
else: return None
views = UnwrapEle... | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
def GetViewTemplate(view):
if not view: return None
elif hasattr(view, "ViewTemplateId"):
if view.ViewTemplateId.IntegerValue == -1: return None
else: return view.Document.GetElement(view.ViewTemplateId)
else: return None
views = UnwrapEle... | none | 1 | 1.968176 | 2 | |
infrastructure-provisioning/src/general/scripts/gcp/dataengine-service_prepare.py | bohdana-kuzmenko/incubator-dlab | 0 | 6265 | <filename>infrastructure-provisioning/src/general/scripts/gcp/dataengine-service_prepare.py
#!/usr/bin/python
# *****************************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# d... | <filename>infrastructure-provisioning/src/general/scripts/gcp/dataengine-service_prepare.py
#!/usr/bin/python
# *****************************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# d... | en | 0.775787 | #!/usr/bin/python # ***************************************************************************** # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The AS... | 1.362627 | 1 |
02.py | mattias-lundell/aoc2021 | 0 | 6266 |
test = """forward 5
down 5
forward 8
up 3
down 8
forward 2
"""
def part1(lines):
h = 0
d = 0
for line in lines:
direction, delta = line.split()
delta = int(delta)
if direction == 'forward':
h += delta
elif direction == 'down':
d += delta
elif... |
test = """forward 5
down 5
forward 8
up 3
down 8
forward 2
"""
def part1(lines):
h = 0
d = 0
for line in lines:
direction, delta = line.split()
delta = int(delta)
if direction == 'forward':
h += delta
elif direction == 'down':
d += delta
elif... | en | 0.64702 | forward 5 down 5 forward 8 up 3 down 8 forward 2 | 3.492278 | 3 |
associations/migrations/0001_initial.py | ollc-code/django-back | 0 | 6267 | <reponame>ollc-code/django-back<gh_stars>0
# Generated by Django 3.1.3 on 2020-11-09 08:56
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Associations',
f... | # Generated by Django 3.1.3 on 2020-11-09 08:56
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Associations',
fields=[
('id', models.AutoF... | en | 0.803111 | # Generated by Django 3.1.3 on 2020-11-09 08:56 | 1.900795 | 2 |
tests/pds/test_times.py | seignovert/pyvims | 4 | 6268 | <reponame>seignovert/pyvims
"""Test PDS times modules."""
from datetime import datetime as dt
from pyvims.pds.times import (cassini2utc, cassini_time, dt_date, dt_doy, dt_iso,
dyear, pds_folder, pds_time, utc2cassini)
from pytest import approx, raises
def test_dt_iso():
"""Test p... | """Test PDS times modules."""
from datetime import datetime as dt
from pyvims.pds.times import (cassini2utc, cassini_time, dt_date, dt_doy, dt_iso,
dyear, pds_folder, pds_time, utc2cassini)
from pytest import approx, raises
def test_dt_iso():
"""Test parsing ISO time pattern."""
... | en | 0.610495 | Test PDS times modules. Test parsing ISO time pattern. Test parsing DOY time pattern. Test date pattern. Test PDS time parsing. Test Cassini time parsing. Test Cassini time to UTC converter. Test UTC to Cassini time converter. Test convert PDS folder as string. Test decimal year. | 2.528267 | 3 |
e/mail-relay/web/apps/mail/migrations/0109_auto_20171130_1047.py | zhouli121018/nodejsgm | 0 | 6269 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mail', '0108_auto_20171130_1004'),
]
operations = [
migrations.AlterModelOptions(
name='relaysenderwhitelist',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mail', '0108_auto_20171130_1004'),
]
operations = [
migrations.AlterModelOptions(
name='relaysenderwhitelist',
... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.346501 | 1 |
venv/lib/python3.6/site-packages/ansible_test/_data/sanity/code-smell/runtime-metadata.py | usegalaxy-no/usegalaxy | 1 | 6270 | #!/usr/bin/env python
"""Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import re
import sys
from distutils.version import StrictVersion, LooseVersion
... | #!/usr/bin/env python
"""Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import re
import sys
from distutils.version import StrictVersion, LooseVersion
... | en | 0.791389 | #!/usr/bin/env python Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml Validate a datetime.date or ISO 8601 date string. # datetime.date objects come from YAML dates, these are ok # make sure we have a string # From Python 3.7 in, there is datetime.date.fromisoformat(). ... | 2.297302 | 2 |
catkin_ws/src/o2ac_flexbe/o2ac_flexbe_states/src/o2ac_flexbe_states/align_bearing_holes.py | mitdo/o2ac-ur | 32 | 6271 | <reponame>mitdo/o2ac-ur
#!/usr/bin/env python
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyActionClient
# example import of required action
from o2ac_msgs.msg import AlignBearingHolesAction, AlignBearingHolesGoal
class AlignBearingHolesActionState(EventState):
'''
Actionlib f... | #!/usr/bin/env python
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyActionClient
# example import of required action
from o2ac_msgs.msg import AlignBearingHolesAction, AlignBearingHolesGoal
class AlignBearingHolesActionState(EventState):
'''
Actionlib for aligning the bearing ... | en | 0.765903 | #!/usr/bin/env python # example import of required action Actionlib for aligning the bearing holes -- task_name string Name of the task <= success AlignBearingHoles completed successfully. <= error AlignBearingHoles failed to execute. # pass required clients as dict (to... | 2.298351 | 2 |
find_unicode_control.py | sebastian-philipp/find-unicode-control | 0 | 6272 | #!/usr/bin/env python3
"""Find unicode control characters in source files
By default the script takes one or more files or directories and looks for
unicode control characters in all text files. To narrow down the files, provide
a config file with the -c command line, defining a scan_exclude list, which
should be a l... | #!/usr/bin/env python3
"""Find unicode control characters in source files
By default the script takes one or more files or directories and looks for
unicode control characters in all text files. To narrow down the files, provide
a config file with the -c command line, defining a scan_exclude list, which
should be a l... | en | 0.832061 | #!/usr/bin/env python3 Find unicode control characters in source files By default the script takes one or more files or directories and looks for unicode control characters in all text files. To narrow down the files, provide a config file with the -c command line, defining a scan_exclude list, which should be a list... | 3.226289 | 3 |
igibson/object_states/aabb.py | mamadbiabon/iGibson | 360 | 6273 | <reponame>mamadbiabon/iGibson
import numpy as np
from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links
from igibson.object_states.object_state_base import CachingEnabledObjectState
class AABB(CachingEnabledObjectState):
def _compute_value(self):
body_id = self.obj.get_body... | import numpy as np
from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links
from igibson.object_states.object_state_base import CachingEnabledObjectState
class AABB(CachingEnabledObjectState):
def _compute_value(self):
body_id = self.obj.get_body_id()
all_links = get_... | en | 0.7994 | # TODO: remove after split floors # room_floor will be set to the correct RoomFloor beforehand # Get the x-y values from the room segmentation map # Use the z values from pybullet # Nothing needs to be done to save/load AABB since it will happen due to pose caching. | 1.97969 | 2 |
vsphere/tests/test_vsphere.py | fujigon/integrations-core | 0 | 6274 | # (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from __future__ import unicode_literals
import time
from datetime import datetime
import mock
import pytest
from mock import MagicMock
from pyVmomi import vim
from datadog_checks.vsphere import VSphereCheck
from... | # (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from __future__ import unicode_literals
import time
from datetime import datetime
import mock
import pytest
from mock import MagicMock
from pyVmomi import vim
from datadog_checks.vsphere import VSphereCheck
from... | en | 0.741082 | # (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # Must define a unique 'name' per vCenter instance # Check default value and precedence of instance config over init config # Test host tags are excluded from external host metadata, but still stored in the cache f... | 1.746118 | 2 |
data_steward/constants/validation/email_notification.py | jp3477/curation | 1 | 6275 | MANDRILL_API_KEY = 'MANDRILL_API_KEY'
UNSET_MANDRILL_API_KEY_MSG = f"Mandrill API key not set in environment variable {MANDRILL_API_KEY}"
CONTACT_LIST_QUERY = """
SELECT *
FROM `{{project}}.{{dataset}}.{{contact_table}}`
"""
EHR_OPERATIONS = 'EHR Ops'
EHR_OPS_ZENDESK = '<EMAIL>'
DATA_CURATION_LISTSERV = '<EMAIL>'
NO_... | MANDRILL_API_KEY = 'MANDRILL_API_KEY'
UNSET_MANDRILL_API_KEY_MSG = f"Mandrill API key not set in environment variable {MANDRILL_API_KEY}"
CONTACT_LIST_QUERY = """
SELECT *
FROM `{{project}}.{{dataset}}.{{contact_table}}`
"""
EHR_OPERATIONS = 'EHR Ops'
EHR_OPS_ZENDESK = '<EMAIL>'
DATA_CURATION_LISTSERV = '<EMAIL>'
NO_... | en | 0.68732 | SELECT * FROM `{{project}}.{{dataset}}.{{contact_table}}` # HPO contact list table columns # Mandrill API constants # Email content <p style="font-size:115%;">Hi {{ site_name }},</p> <p style="font-size:115%;">Your submission <b>{{ folder }}</b> {% if submission_error %}was NOT successfully loaded on {{ timestamp }}.... | 1.563439 | 2 |
clip/clip.py | keshav11/clip | 1 | 6276 | <filename>clip/clip.py
import os
import argparse
from pathlib import Path
CLIP_FILE = os.path.join(Path.home(), '.clip')
TEMP_FILE = '.TEMP_FILE'
def add_text(key, text):
if os.path.exists(CLIP_FILE):
open_mode = 'a'
else:
open_mode = 'w+'
with open(CLIP_FILE, open_mode) as clip_file:
... | <filename>clip/clip.py
import os
import argparse
from pathlib import Path
CLIP_FILE = os.path.join(Path.home(), '.clip')
TEMP_FILE = '.TEMP_FILE'
def add_text(key, text):
if os.path.exists(CLIP_FILE):
open_mode = 'a'
else:
open_mode = 'w+'
with open(CLIP_FILE, open_mode) as clip_file:
... | none | 1 | 3.287216 | 3 | |
tests/unit/test_nsga2.py | learsi1911/GAMA_pygmo_v4 | 49 | 6277 | <filename>tests/unit/test_nsga2.py
from typing import List, Tuple
from gama.genetic_programming.nsga2 import (
NSGAMeta,
fast_non_dominated_sort,
crowding_distance_assignment,
)
def _tuples_to_NSGAMeta(tuples: List[Tuple]) -> List[NSGAMeta]:
""" Converts a list of tuples to NSGAMeta objects. """
#... | <filename>tests/unit/test_nsga2.py
from typing import List, Tuple
from gama.genetic_programming.nsga2 import (
NSGAMeta,
fast_non_dominated_sort,
crowding_distance_assignment,
)
def _tuples_to_NSGAMeta(tuples: List[Tuple]) -> List[NSGAMeta]:
""" Converts a list of tuples to NSGAMeta objects. """
#... | en | 0.813427 | Converts a list of tuples to NSGAMeta objects. # Can't declare it directly in a loop as it does not create a new scope. # In our implementation, we ignore 'axis' that contain inf values. # assigns rank # assigns distance | 2.588447 | 3 |
stac_ingest/utils/tds.py | crim-ca/stac-ingest | 0 | 6278 | # File taken from https://github.com/Ouranosinc/pavics-vdb/blob/master/catalog/tds.py
"""Utility function to parse metadata from a THREDDS Data Server catalog."""
def walk(cat, depth=1):
"""Return a generator walking a THREDDS data catalog for datasets.
Parameters
----------
cat : TDSCatalog
T... | # File taken from https://github.com/Ouranosinc/pavics-vdb/blob/master/catalog/tds.py
"""Utility function to parse metadata from a THREDDS Data Server catalog."""
def walk(cat, depth=1):
"""Return a generator walking a THREDDS data catalog for datasets.
Parameters
----------
cat : TDSCatalog
T... | en | 0.658707 | # File taken from https://github.com/Ouranosinc/pavics-vdb/blob/master/catalog/tds.py Utility function to parse metadata from a THREDDS Data Server catalog. Return a generator walking a THREDDS data catalog for datasets. Parameters ---------- cat : TDSCatalog THREDDS catalog. depth : int Ma... | 2.624147 | 3 |
tact/util.py | brunel-physics/mva_scikit | 0 | 6279 | <reponame>brunel-physics/mva_scikit
# -*- coding: utf-8 -*-
"""
Module containing miscellaneous utility functions.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import collections
import itertools
import numpy as np
class BinaryTree(object):
d... | # -*- coding: utf-8 -*-
"""
Module containing miscellaneous utility functions.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import collections
import itertools
import numpy as np
class BinaryTree(object):
def __init__(self):
self.left... | en | 0.730151 | # -*- coding: utf-8 -*- Module containing miscellaneous utility functions. Adds key-value pairs in d2 to d1. Conflicts are resolved in favour of d2. Recurses into all values in d2 which belong to the collections.Mapping abstract base class. Parameters ---------- d1 : collections.Mapping Ba... | 2.972059 | 3 |
src/stochastic_tour.py | DavidNKraemer/ams553-final-project | 0 | 6280 |
import numpy as np
import random
from collections import namedtuple
def generate_prob_matrix(n):
matrix = np.random.rand(n, n)
for i in range(n):
matrix[i][i] = 0
for i in range(n):
matrix[i] = (1/np.sum(matrix[i]))*matrix[i]
return matrix
def categorical(p):
return np.random... |
import numpy as np
import random
from collections import namedtuple
def generate_prob_matrix(n):
matrix = np.random.rand(n, n)
for i in range(n):
matrix[i][i] = 0
for i in range(n):
matrix[i] = (1/np.sum(matrix[i]))*matrix[i]
return matrix
def categorical(p):
return np.random... | none | 1 | 3.057102 | 3 | |
orbit/actions/conditional_action_test.py | mcasanova1445/models | 1 | 6281 | <filename>orbit/actions/conditional_action_test.py
# Copyright 2022 The Orbit 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/licen... | <filename>orbit/actions/conditional_action_test.py
# Copyright 2022 The Orbit 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/licen... | en | 0.866066 | # Copyright 2022 The Orbit 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 applicable l... | 2.739763 | 3 |
Customizations/Tagging/show_tags.task.py | phnomcobra/valarie-content | 0 | 6282 | <reponame>phnomcobra/valarie-content
#!/usr/bin/python
################################################################################
# DOCUMENTS
#
# <NAME>
# <EMAIL>
# 614 692 2050
#
# 04/22/2018 Original Construction
################################################################################
import traceback
... | #!/usr/bin/python
################################################################################
# DOCUMENTS
#
# <NAME>
# <EMAIL>
# 614 692 2050
#
# 04/22/2018 Original Construction
################################################################################
import traceback
import json
class Task:
def __in... | de | 0.667438 | #!/usr/bin/python ################################################################################ # DOCUMENTS # # <NAME> # <EMAIL> # 614 692 2050 # # 04/22/2018 Original Construction ################################################################################ #key.set() | 2.233507 | 2 |
examples/python/masked_hist.py | DerThorsten/seglib | 0 | 6283 | import vigra
import numpy
import pylab
from seglib import cgp2d
from seglib.preprocessing import norm01
import seglib.edge_detectors.pixel as edp
import seglib.region_descriptors.pixel as rdp
from seglib.preprocessing import norm01
from seglib.histogram import jointHistogram,histogram
from seglib.region_descriptors.p... | import vigra
import numpy
import pylab
from seglib import cgp2d
from seglib.preprocessing import norm01
import seglib.edge_detectors.pixel as edp
import seglib.region_descriptors.pixel as rdp
from seglib.preprocessing import norm01
from seglib.histogram import jointHistogram,histogram
from seglib.region_descriptors.p... | en | 0.330271 | # change me to your path #[0:75,0:75,:] #cgp2d.visualize(imgBig,cgp=cgp) #for c in range(histImg.shape[2]): # #print c # pylab.imshow( numpy.swapaxes( norm01(histImg[:,:,c]) ,0,1) ) # pylab.show() # # print "hist",hist.shape #'cityblock') | 2.588433 | 3 |
backup/models.py | helwete/simple-backup | 0 | 6284 | <reponame>helwete/simple-backup<filename>backup/models.py
from datetime import date
from django.conf import settings
from django.db import models
# Create your models here.
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
today = date.today()
return '... | from datetime import date
from django.conf import settings
from django.db import models
# Create your models here.
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
today = date.today()
return '{0}/{2}/{1}'.format(instance.user.username, filename, toda... | en | 0.962408 | # Create your models here. # file will be uploaded to MEDIA_ROOT/user_<id>/<filename> | 2.553703 | 3 |
Kmeans Cluster/Kmeans_Compare.py | Jojoxiao/Machine-Learning-for-Beginner-by-Python3 | 397 | 6285 | #-*- coding:utf-8 -*-
# &Author AnFany
# 引入方法
import Kmeans_AnFany as K_Af # AnFany
import Kmeans_Sklearn as K_Sk # Sklearn
import matplotlib.pyplot as plt
from pylab import mpl # 作图显示中文
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体
mpl.rcParams['axes.unicode_minus'] = False
import numpy as... | #-*- coding:utf-8 -*-
# &Author AnFany
# 引入方法
import Kmeans_AnFany as K_Af # AnFany
import Kmeans_Sklearn as K_Sk # Sklearn
import matplotlib.pyplot as plt
from pylab import mpl # 作图显示中文
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体
mpl.rcParams['axes.unicode_minus'] = False
import numpy as... | zh | 0.846443 | #-*- coding:utf-8 -*- # &Author AnFany # 引入方法 # AnFany # Sklearn # 作图显示中文 # 设置中文字体新宋体 # 利用sklearn生成数据集 # 绘制散点图 #plt.legend(['%d类'%i for i in typeclass], bbox_to_anchor=(1.2, 0.9)) # 调用不同的方法 # AnFany # Sklearn #绘制算法后的类别的散点图 # 绘制样本散点图 #绘制类别中心点 # 绘制类别中心点 # 定义欧几里得距离 # 计算最终的分类结果的成本值 # 均值 # 最终的结果展示 | 2.697557 | 3 |
control_panel.py | Stayermax/5dof-bartender-robot | 0 | 6286 | #!/usr/bin/env python
"""
Control panel file
"""
import pddl_solver as pddl
import ik
import rospy
from get_object_position import get_object_position
import time
from constants import *
from spawn_models import reset_model_position, reset_all, spawn_model, spawn_all_models
from delete_models import delete_all, de... | #!/usr/bin/env python
"""
Control panel file
"""
import pddl_solver as pddl
import ik
import rospy
from get_object_position import get_object_position
import time
from constants import *
from spawn_models import reset_model_position, reset_all, spawn_model, spawn_all_models
from delete_models import delete_all, de... | en | 0.630645 | #!/usr/bin/env python Control panel file # robot.go_to_init_state() # robot.open_gripper() # simulatiuon # real_world # current_bottle_orig_pos = Real_poses(bottle) # current_bottle_orig_pos[-1] += BZS # open the gripper # close the gripper # go to initial pose # go to bottle # hover over the bottle # go to cup # simul... | 2.692723 | 3 |
Enigma/Enigma.py | archanpatkar/Enigma | 3 | 6287 | from Enigma.Rotor import Rotor
from Enigma.Reflector import Reflector
from Enigma.Plugboard import Plugboard
class Enigma:
def __init__(self , rotors = [ Rotor(0,"IC") , Rotor(0,"IIC") , Rotor(0,"IIIC") ] , plugboard = Plugboard() , reflector = Reflector("A")):
self.rotors = rotors
for i in r... | from Enigma.Rotor import Rotor
from Enigma.Reflector import Reflector
from Enigma.Plugboard import Plugboard
class Enigma:
def __init__(self , rotors = [ Rotor(0,"IC") , Rotor(0,"IIC") , Rotor(0,"IIIC") ] , plugboard = Plugboard() , reflector = Reflector("A")):
self.rotors = rotors
for i in r... | none | 1 | 2.848032 | 3 | |
var/spack/repos/builtin/packages/exiv2/package.py | xiki-tempula/spack | 9 | 6288 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Exiv2(CMakePackage):
"""Exiv2 is a Cross-platform C++ library and a command line utility
... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Exiv2(CMakePackage):
"""Exiv2 is a Cross-platform C++ library and a command line utility
... | en | 0.715282 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) Exiv2 is a Cross-platform C++ library and a command line utility to manage image metadata | 1.015222 | 1 |
magicauth/send_token.py | JMIdeaMaker/django-magicauth | 0 | 6289 | import math
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.template import loader
from magicauth import settings as magicauth_settings
from django.conf import settings as django_settings
from magicauth.model... | import math
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.template import loader
from magicauth import settings as magicauth_settings
from django.conf import settings as django_settings
from magicauth.model... | en | 0.832233 | Helper for sending an email containing a link containing the MagicToken. Query the DB for the user corresponding to the email. - We use get_user_model() instead of User (in case the Django app has customised the User class) - We use magicauth_settings.EMAIL_FIELD, which is the name of the fiel... | 2.324401 | 2 |
qcdb/util/paths.py | loriab/qccddb | 8 | 6290 | <gh_stars>1-10
import os
import sys
## {{{ http://code.activestate.com/recipes/52224/ (r1)
def search_file(filename, search_path):
"""Given an os.pathsep divided `search_path`, find first occurrence of
`filename`. Returns full path to file if found or None if unfound.
"""
file_found = False
paths... | import os
import sys
## {{{ http://code.activestate.com/recipes/52224/ (r1)
def search_file(filename, search_path):
"""Given an os.pathsep divided `search_path`, find first occurrence of
`filename`. Returns full path to file if found or None if unfound.
"""
file_found = False
paths = search_path.... | en | 0.614172 | ## {{{ http://code.activestate.com/recipes/52224/ (r1) Given an os.pathsep divided `search_path`, find first occurrence of `filename`. Returns full path to file if found or None if unfound. # paths = string.split(search_path, os.pathsep) ## end of http://code.activestate.com/recipes/52224/ }}} Function to return a ... | 3.2129 | 3 |
tests/models/DCN_test.py | JiangBowen-master/DeepCTR | 1 | 6291 | <filename>tests/models/DCN_test.py
import pytest
import tensorflow as tf
from deepctr.estimator import DCNEstimator
from deepctr.models import DCN
from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \
Estimator_TEST_TF1
@pytest.mark.parametrize(
'cross_num,h... | <filename>tests/models/DCN_test.py
import pytest
import tensorflow as tf
from deepctr.estimator import DCNEstimator
from deepctr.models import DCN
from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \
Estimator_TEST_TF1
@pytest.mark.parametrize(
'cross_num,h... | en | 0.270735 | # def test_DCN_invalid(embedding_size=8, cross_num=0, hidden_size=()): # feature_dim_dict = {'sparse': [SparseFeat('sparse_1', 2), SparseFeat('sparse_2', 5), SparseFeat('sparse_3', 10)], # 'dense': [SparseFeat('dense_1', 1), SparseFeat('dense_1', 1), SparseFeat('dense_1', 1)]} # with pyt... | 2.291804 | 2 |
workflows/post_process_run/fv3post/gsutil.py | jacnugent/fv3net | 5 | 6292 | <filename>workflows/post_process_run/fv3post/gsutil.py<gh_stars>1-10
import os
import subprocess
import backoff
class GSUtilResumableUploadException(Exception):
pass
def _decode_to_str_if_bytes(s, encoding="utf-8"):
if isinstance(s, bytes):
return s.decode(encoding)
else:
return s
def... | <filename>workflows/post_process_run/fv3post/gsutil.py<gh_stars>1-10
import os
import subprocess
import backoff
class GSUtilResumableUploadException(Exception):
pass
def _decode_to_str_if_bytes(s, encoding="utf-8"):
if isinstance(s, bytes):
return s.decode(encoding)
else:
return s
def... | en | 0.822466 | # Pipe stderr to stdout because gsutil logs upload progress there. | 2.18035 | 2 |
deploy_tix/__main__.py | rpappalax/deploy-tix | 0 | 6293 | import argparse
from deploy_tix.bugzilla_rest_client import BugzillaRESTClient
from deploy_tix.release_notes import ReleaseNotes
from output_helper import OutputHelper
def main(args=None):
parser = argparse.ArgumentParser(
description='Scripts for creating / updating deployment tickets in \
Bugzi... | import argparse
from deploy_tix.bugzilla_rest_client import BugzillaRESTClient
from deploy_tix.release_notes import ReleaseNotes
from output_helper import OutputHelper
def main(args=None):
parser = argparse.ArgumentParser(
description='Scripts for creating / updating deployment tickets in \
Bugzi... | en | 0.207597 | # parser for ticket - {create} option # parser for ticket - {upate} option # noqa | 2.258708 | 2 |
site-packages/visual/examples/drape.py | lebarsfa/vpython-wx | 68 | 6294 | from visual import *
print("""
Click to place spheres under falling string.
Right button drag or Ctrl-drag to rotate view.
Middle button drag or Alt-drag to zoom in or out.
On a two-button mouse, middle is left + right.
""")
# <NAME>
scene.title = "Drape"
restlength = 0.02
m = 0.010 * restlength
g = ... | from visual import *
print("""
Click to place spheres under falling string.
Right button drag or Ctrl-drag to rotate view.
Middle button drag or Alt-drag to zoom in or out.
On a two-button mouse, middle is left + right.
""")
# <NAME>
scene.title = "Drape"
restlength = 0.02
m = 0.010 * restlength
g = ... | en | 0.818101 | Click to place spheres under falling string.
Right button drag or Ctrl-drag to rotate view.
Middle button drag or Alt-drag to zoom in or out.
On a two-button mouse, middle is left + right. # <NAME> # Create the stringy thing: # Let the user position obstacles: #(i*0.6 - 0.7,0.5 + i*0.1,0), # need a more physical w... | 3.50384 | 4 |
sdc/utilities/sdc_typing_utils.py | dlee992/sdc | 540 | 6295 | # *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | # *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | en | 0.685718 | # ***************************************************************************** # Copyright (c) 2020, Intel Corporation All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of sou... | 1.582469 | 2 |
Hackerrank/Contests/Project Euler/euler010.py | PROxZIMA/Competitive-Coding | 1 | 6296 | <reponame>PROxZIMA/Competitive-Coding
from math import sqrt
# Naive method: Loop through N and check if every number is prime or not. If prime add to sum. Time complexity is O(√n). Time of execution ~ 8sec for n = 1000000
def prime(n):
yield 2
yield 3
for p in range(5, n+1, 2):
if p % 3 == 0:
... | from math import sqrt
# Naive method: Loop through N and check if every number is prime or not. If prime add to sum. Time complexity is O(√n). Time of execution ~ 8sec for n = 1000000
def prime(n):
yield 2
yield 3
for p in range(5, n+1, 2):
if p % 3 == 0:
continue
else:
... | en | 0.799914 | # Naive method: Loop through N and check if every number is prime or not. If prime add to sum. Time complexity is O(√n). Time of execution ~ 8sec for n = 1000000 # Sieve implementation: Time complexity of O(n*log(log(n))). Time of execution ~ 2sec for n = 1000000 | 3.810692 | 4 |
DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py | ckamtsikis/cmssw | 852 | 6297 | <filename>DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
l1EmulatorErrorFlagClient = DQMEDHarvester("L1EmulatorErrorFlagClient",
#
# for each L1 system, give:
# - SystemLa... | <filename>DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
l1EmulatorErrorFlagClient = DQMEDHarvester("L1EmulatorErrorFlagClient",
#
# for each L1 system, give:
# - SystemLa... | en | 0.742868 | # # for each L1 system, give: # - SystemLabel: system label # - HwValLabel: system label as used in hardware validation package # (the package producing the ErrorFlag histogram) # - SystemMask: system mask: if 1, the system is masked in the summary plot # - SystemFolder: the fol... | 2.109286 | 2 |
codalab/model/tables.py | jzwang43/codalab-worksheets | 0 | 6298 | <filename>codalab/model/tables.py
"""
The SQLAlchemy table objects for the CodaLab bundle system tables.
"""
# TODO: Replace String and Text columns with Unicode and UnicodeText as appropriate
# This way, SQLAlchemy will automatically perform conversions to and from UTF-8
# encoding, or use appropriate database engine-... | <filename>codalab/model/tables.py
"""
The SQLAlchemy table objects for the CodaLab bundle system tables.
"""
# TODO: Replace String and Text columns with Unicode and UnicodeText as appropriate
# This way, SQLAlchemy will automatically perform conversions to and from UTF-8
# encoding, or use appropriate database engine-... | en | 0.8446 | The SQLAlchemy table objects for the CodaLab bundle system tables. # TODO: Replace String and Text columns with Unicode and UnicodeText as appropriate # This way, SQLAlchemy will automatically perform conversions to and from UTF-8 # encoding, or use appropriate database engine-specific data types for Unicode # data. Cu... | 2.222548 | 2 |
grpc/plugins/connection/gnmi.py | hansthienpondt/ansible-networking-collections | 0 | 6299 | <reponame>hansthienpondt/ansible-networking-collections
# (c) 2020 Nokia
#
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
author:
- "<NAME> (@HansThienpondt)"
- "<NA... | # (c) 2020 Nokia
#
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
author:
- "<NAME> (@HansThienpondt)"
- "<NAME> (@wisotzky)"
connection: gnmi
short_description: Pro... | en | 0.718666 | # (c) 2020 Nokia # # Licensed under the BSD 3 Clause license # SPDX-License-Identifier: BSD-3-Clause # --- author: - "<NAME> (@HansThienpondt)" - "<NAME> (@wisotzky)" connection: gnmi short_description: Provides a persistent gRPC connection for gNMI API service description: - This gRPC plugin provides methods to ... | 1.63859 | 2 |