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 |
|---|---|---|---|---|---|---|---|---|---|---|
app/util/auth2.py | FSU-ACM/Contest-Server | 8 | 6400 | """ util.auth2: Authentication tools
This module is based off of util.auth, except with the action
paradigm removed.
"""
from flask import session
from app.models import Account
from app.util import course as course_util
# Session keys
SESSION_EMAIL = 'email'
def create_account(email: str, password: str, f... | """ util.auth2: Authentication tools
This module is based off of util.auth, except with the action
paradigm removed.
"""
from flask import session
from app.models import Account
from app.util import course as course_util
# Session keys
SESSION_EMAIL = 'email'
def create_account(email: str, password: str, f... | en | 0.707414 | util.auth2: Authentication tools This module is based off of util.auth, except with the action paradigm removed. # Session keys Creates an account for a single user. :email: Required, the email address of the user. :password: Required, user's chosen password. :first_name: Required, user's first na... | 3.069084 | 3 |
FeView/pstaticwidget.py | motiurce/FeView | 10 | 6401 | from PyQt5.QtWidgets import *
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
class PstaticWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self... | from PyQt5.QtWidgets import *
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
class PstaticWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self... | none | 1 | 2.512949 | 3 | |
pyallocation/solvers/exhaustive.py | julesy89/pyallocation | 0 | 6402 | <gh_stars>0
import numpy as np
from pymoo.core.algorithm import Algorithm
from pymoo.core.population import Population
from pymoo.util.termination.no_termination import NoTermination
from pyallocation.allocation import FastAllocation
from pyallocation.problem import AllocationProblem
def exhaustively(problem):
a... | import numpy as np
from pymoo.core.algorithm import Algorithm
from pymoo.core.population import Population
from pymoo.util.termination.no_termination import NoTermination
from pyallocation.allocation import FastAllocation
from pyallocation.problem import AllocationProblem
def exhaustively(problem):
alloc = FastA... | none | 1 | 2.397401 | 2 | |
config.py | yasminbraga/ufopa-reports | 0 | 6403 | import os
class Config:
CSRF_ENABLED = True
SECRET_KEY = 'your-very-very-secret-key'
SQLALCHEMY_DATABASE_URI = 'postgresql:///flask_template_dev'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = True
class Development(Config):
ENV = 'development'
DEBUG = True
TESTING = False
... | import os
class Config:
CSRF_ENABLED = True
SECRET_KEY = 'your-very-very-secret-key'
SQLALCHEMY_DATABASE_URI = 'postgresql:///flask_template_dev'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = True
class Development(Config):
ENV = 'development'
DEBUG = True
TESTING = False
... | none | 1 | 1.758193 | 2 | |
heat/api/openstack/v1/views/stacks_view.py | noironetworks/heat | 265 | 6404 | <reponame>noironetworks/heat
#
# 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... | #
# 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
# ... | en | 0.779405 | # # 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 # ... | 1.752225 | 2 |
pykrev/formula/find_intersections.py | Kzra/pykrev | 4 | 6405 | import itertools
import numpy as np
import pandas as pd
def find_intersections(formula_lists,group_labels,exclusive = True):
"""
Docstring for function pyKrev.find_intersections
====================
This function compares n lists of molecular formula and outputs a dictionary containing the intersections... | import itertools
import numpy as np
import pandas as pd
def find_intersections(formula_lists,group_labels,exclusive = True):
"""
Docstring for function pyKrev.find_intersections
====================
This function compares n lists of molecular formula and outputs a dictionary containing the intersections... | en | 0.802597 | Docstring for function pyKrev.find_intersections ==================== This function compares n lists of molecular formula and outputs a dictionary containing the intersections between each list. Use ---- find_intersections([list_1,..,list_n],['group_1',...,'group_n']) Returns a dictionary in which ... | 3.518326 | 4 |
Create Playlist.py | j4ck64/PlaylistDirectories | 0 | 6406 | import os
import glob
import shutil
from tinytag import TinyTag
""" root = 'C:/'
copy_to = '/copy to/folder'
tag = TinyTag.get('C:/Users/jchap/OneDrive/Pictures/(VERYRAREBOYZ) (feat. $ki Mask The Slump God and Drugz).mp3')
print(tag.artist)
print('song duration: '+str(tag.duration))
"""
f = []
f=glob.gl... | import os
import glob
import shutil
from tinytag import TinyTag
""" root = 'C:/'
copy_to = '/copy to/folder'
tag = TinyTag.get('C:/Users/jchap/OneDrive/Pictures/(VERYRAREBOYZ) (feat. $ki Mask The Slump God and Drugz).mp3')
print(tag.artist)
print('song duration: '+str(tag.duration))
"""
f = []
f=glob.gl... | en | 0.695158 | root = 'C:/'
copy_to = '/copy to/folder'
tag = TinyTag.get('C:/Users/jchap/OneDrive/Pictures/(VERYRAREBOYZ) (feat. $ki Mask The Slump God and Drugz).mp3')
print(tag.artist)
print('song duration: '+str(tag.duration)) # tag = TinyTag.get(f[0]) # print(tag.artist) # for root, dirs, files in os.walk("C:/Users/jchap/One... | 2.768629 | 3 |
PyBank/main.py | Alexis-Kepano/python_challenge | 0 | 6407 | #import modules
import os
import csv
#input
csvpath = os.path.join('Resources', 'budget_data.csv')
#output
outfile = os.path.join('Analysis', 'pybankstatements.txt')
#declare variables
months = []; total_m = 1; net_total = 0; total_change = 0; monthly_changes = []; greatest_inc = ['', 0]; greatest_dec = ['', 0]
#open... | #import modules
import os
import csv
#input
csvpath = os.path.join('Resources', 'budget_data.csv')
#output
outfile = os.path.join('Analysis', 'pybankstatements.txt')
#declare variables
months = []; total_m = 1; net_total = 0; total_change = 0; monthly_changes = []; greatest_inc = ['', 0]; greatest_dec = ['', 0]
#open... | ja | 0.125084 | #import modules #input #output #declare variables #open & read csv #loop | 3.266123 | 3 |
bot/constants/messages.py | aasw0ng/thornode-telegram-bot | 15 | 6408 | <gh_stars>10-100
from enum import Enum
from constants.globals import HEALTH_EMOJIS
NETWORK_ERROR = '😱 There was an error while getting data 😱\nAn API endpoint is down!'
HEALTH_LEGEND = f'\n*Node health*:\n{HEALTH_EMOJIS[True]} - *healthy*\n{HEALTH_EMOJIS[False]} - *unhealthy*\n' \
f'{HEALTH_EMOJIS[N... | from enum import Enum
from constants.globals import HEALTH_EMOJIS
NETWORK_ERROR = '😱 There was an error while getting data 😱\nAn API endpoint is down!'
HEALTH_LEGEND = f'\n*Node health*:\n{HEALTH_EMOJIS[True]} - *healthy*\n{HEALTH_EMOJIS[False]} - *unhealthy*\n' \
f'{HEALTH_EMOJIS[None]} - *unknown*... | none | 1 | 2.864294 | 3 | |
src/interactive_conditional_samples.py | RanHerOver/cometaai | 0 | 6409 | <reponame>RanHerOver/cometaai
import random
import fire
import json
import os
import numpy as np
import tensorflow as tf
import pytumblr
import mysql.connector
import datetime
from random import seed
import model, sample, encoder
def interact_model(
model_name='1558M',
seed=None,
nsamples=1,
batch_size... | import random
import fire
import json
import os
import numpy as np
import tensorflow as tf
import pytumblr
import mysql.connector
import datetime
from random import seed
import model, sample, encoder
def interact_model(
model_name='1558M',
seed=None,
nsamples=1,
batch_size=1,
length=None,
tempe... | it | 0.974588 | # Autenticazione # Al fine di mantenere la sicurezza del mio account le due coppie di chiavi per la connessione a Tumblr sono state eliminate da questo file. # Connessione al DB # Generazione query # Formattazione del prompt # Riceve e trattiene le informazioni del profilo # Carico il modello dalla directory # Eseguo u... | 2.333468 | 2 |
desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py | kokosing/hue | 422 | 6410 | <filename>desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py
from sys import version_info
if version_info[0] <= 2 and version_info[1] <= 4:
def all(iterable):
for element in iterable:
if not element:
return False
return True
else:
all = all
| <filename>desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py
from sys import version_info
if version_info[0] <= 2 and version_info[1] <= 4:
def all(iterable):
for element in iterable:
if not element:
return False
return True
else:
all = all
| none | 1 | 2.444665 | 2 | |
src/cms/carousels/serializers.py | UniversitaDellaCalabria/uniCMS | 6 | 6411 | from rest_framework import serializers
from cms.api.serializers import UniCMSContentTypeClass, UniCMSCreateUpdateSerializer
from cms.medias.serializers import MediaSerializer
from . models import Carousel, CarouselItem, CarouselItemLink, CarouselItemLinkLocalization, CarouselItemLocalization
class CarouselForeignK... | from rest_framework import serializers
from cms.api.serializers import UniCMSContentTypeClass, UniCMSCreateUpdateSerializer
from cms.medias.serializers import MediaSerializer
from . models import Carousel, CarouselItem, CarouselItemLink, CarouselItemLinkLocalization, CarouselItemLocalization
class CarouselForeignK... | en | 0.479908 | # pragma: no cover # pragma: no cover # pragma: no cover | 2.052274 | 2 |
demos/colorization_demo/python/colorization_demo.py | mzegla/open_model_zoo | 0 | 6412 | #!/usr/bin/env python3
"""
Copyright (c) 2018-2021 Intel Corporation
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 applic... | #!/usr/bin/env python3
"""
Copyright (c) 2018-2021 Intel Corporation
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 applic... | en | 0.828821 | #!/usr/bin/env python3 Copyright (c) 2018-2021 Intel Corporation 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 ... | 1.802245 | 2 |
swagger_client/models/transfer.py | chbndrhnns/ahoi-client | 0 | 6413 | # coding: utf-8
"""
[AHOI cookbook](/ahoi/docs/cookbook/index.html) [Data Privacy](/sandboxmanager/#/privacy) [Terms of Service](/sandboxmanager/#/terms) [Imprint](https://sparkassen-hub.com/impressum/) © 2016‐2017 Starfinanz - Ein Unternehmen der Finanz Informatik # noqa: E501
OpenAPI sp... | # coding: utf-8
"""
[AHOI cookbook](/ahoi/docs/cookbook/index.html) [Data Privacy](/sandboxmanager/#/privacy) [Terms of Service](/sandboxmanager/#/terms) [Imprint](https://sparkassen-hub.com/impressum/) © 2016‐2017 Starfinanz - Ein Unternehmen der Finanz Informatik # noqa: E501
OpenAPI sp... | en | 0.609939 | # coding: utf-8 [AHOI cookbook](/ahoi/docs/cookbook/index.html) [Data Privacy](/sandboxmanager/#/privacy) [Terms of Service](/sandboxmanager/#/terms) [Imprint](https://sparkassen-hub.com/impressum/) © 2016‐2017 Starfinanz - Ein Unternehmen der Finanz Informatik # noqa: E501 OpenAPI spec version: 2.1... | 1.976102 | 2 |
external/trappy/tests/test_caching.py | vdonnefort/lisa | 1 | 6414 | # Copyright 2015-2017 ARM Limited, Google and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2015-2017 ARM Limited, Google and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | en | 0.862822 | # Copyright 2015-2017 ARM Limited, Google and contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica... | 1.870234 | 2 |
src/mf_horizon_client/client/pipelines/blueprints.py | MF-HORIZON/mf-horizon-python-client | 0 | 6415 | from enum import Enum
class BlueprintType(Enum):
"""
A blueprint is a pipeline template in horizon, and must be specified when creating a new pipeline
Nonlinear
===============================================================================================================
A nonlinear pipeline co... | from enum import Enum
class BlueprintType(Enum):
"""
A blueprint is a pipeline template in horizon, and must be specified when creating a new pipeline
Nonlinear
===============================================================================================================
A nonlinear pipeline co... | en | 0.723686 | A blueprint is a pipeline template in horizon, and must be specified when creating a new pipeline Nonlinear =============================================================================================================== A nonlinear pipeline combines nonlinear feature generation and selection with a nonlin... | 2.631181 | 3 |
pyChess/olaf/views.py | An-Alone-Cow/pyChess | 0 | 6416 | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.utils import timezone
from olaf.models import *
from olaf.forms import *
from... | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.utils import timezone
from olaf.models import *
from olaf.forms import *
from... | en | 0.37464 | #view functions | 2.018524 | 2 |
ce_vae_test/main_cetrainer.py | fgitmichael/SelfSupevisedSkillDiscovery | 0 | 6417 | <reponame>fgitmichael/SelfSupevisedSkillDiscovery<gh_stars>0
from __future__ import print_function
import argparse
import torch
import torch.utils.data
import matplotlib.pyplot as plt
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from torchvision.utils imp... | from __future__ import print_function
import argparse
import torch
import torch.utils.data
import matplotlib.pyplot as plt
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from torchvision.utils import save_image
from torch.utils.tensorboard import SummaryWri... | none | 1 | 2.163932 | 2 | |
appr/commands/logout.py | sergeyberezansky/appr | 31 | 6418 | <filename>appr/commands/logout.py
from __future__ import absolute_import, division, print_function
from appr.auth import ApprAuth
from appr.commands.command_base import CommandBase, PackageSplit
class LogoutCmd(CommandBase):
name = 'logout'
help_message = "logout"
def __init__(self, options):
su... | <filename>appr/commands/logout.py
from __future__ import absolute_import, division, print_function
from appr.auth import ApprAuth
from appr.commands.command_base import CommandBase, PackageSplit
class LogoutCmd(CommandBase):
name = 'logout'
help_message = "logout"
def __init__(self, options):
su... | none | 1 | 2.519687 | 3 | |
musica/apps.py | webnowone/albumMusical | 1 | 6419 | <reponame>webnowone/albumMusical<gh_stars>1-10
from django.apps import AppConfig
class MusicaConfig(AppConfig):
name = 'musica'
| from django.apps import AppConfig
class MusicaConfig(AppConfig):
name = 'musica' | none | 1 | 1.202074 | 1 | |
tzwhere/tzwhere.py | tuxiqae/pytzwhere | 115 | 6420 | <reponame>tuxiqae/pytzwhere
#!/usr/bin/env python
'''tzwhere.py - time zone computation from latitude/longitude.
Ordinarily this is loaded as a module and instances of the tzwhere
class are instantiated and queried directly
'''
import collections
try:
import ujson as json # loads 2 seconds faster than normal jso... | #!/usr/bin/env python
'''tzwhere.py - time zone computation from latitude/longitude.
Ordinarily this is loaded as a module and instances of the tzwhere
class are instantiated and queried directly
'''
import collections
try:
import ujson as json # loads 2 seconds faster than normal json
except:
try:
i... | en | 0.794137 | #!/usr/bin/env python tzwhere.py - time zone computation from latitude/longitude. Ordinarily this is loaded as a module and instances of the tzwhere class are instantiated and queried directly # loads 2 seconds faster than normal json # We can save about 222MB of RAM by turning our polygon lists into # numpy arrays ra... | 2.71997 | 3 |
tests/home_assistant/custom_features.py | jre21/mindmeld | 1 | 6421 | <filename>tests/home_assistant/custom_features.py<gh_stars>1-10
from mindmeld.models.helpers import register_query_feature
@register_query_feature(feature_name='average-token-length')
def extract_average_token_length(**args):
"""
Example query feature that gets the average length of normalized tokens in the q... | <filename>tests/home_assistant/custom_features.py<gh_stars>1-10
from mindmeld.models.helpers import register_query_feature
@register_query_feature(feature_name='average-token-length')
def extract_average_token_length(**args):
"""
Example query feature that gets the average length of normalized tokens in the q... | en | 0.656451 | Example query feature that gets the average length of normalized tokens in the query„ Returns: (function) A feature extraction function that takes a query and returns the average normalized token length # pylint: disable=locally-disabled,unused-argument | 2.832613 | 3 |
source/statuscodes.py | woody2371/fishbowl-api | 6 | 6422 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def getstatus(code):
if code == "1000":
value = "Success!"
elif code == "1001":
value = "Unknown Message Received"
elif code == "1002":
value = "Connection to Fishbowl Server was lost"
elif code == "1003":
value = "Some Requests ... | #!/usr/bin/python
# -*- coding: utf-8 -*-
def getstatus(code):
if code == "1000":
value = "Success!"
elif code == "1001":
value = "Unknown Message Received"
elif code == "1002":
value = "Connection to Fishbowl Server was lost"
elif code == "1003":
value = "Some Requests ... | en | 0.44423 | #!/usr/bin/python # -*- coding: utf-8 -*- | 2.210317 | 2 |
app/src/server/hoge/hoge_api.py | jacob327/docker-flask-nginx-uwsgi-mysql | 0 | 6423 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# [Import start]
from flask import Blueprint, jsonify
# [Import end]
app = Blueprint(
'hoge',
__name__,
url_prefix='/hoge'
)
@app.route('/test')
def hoge():
return "\nhogehoge"
| #!/usr/bin/python
# -*- coding: utf-8 -*-
# [Import start]
from flask import Blueprint, jsonify
# [Import end]
app = Blueprint(
'hoge',
__name__,
url_prefix='/hoge'
)
@app.route('/test')
def hoge():
return "\nhogehoge"
| en | 0.528606 | #!/usr/bin/python # -*- coding: utf-8 -*- # [Import start] # [Import end] | 2.220613 | 2 |
preinstall_setup/makedeb-11.0.1-1-stable/src/makedeb/utils/missing_apt_dependencies.py | chipbuster/Energy-Languages-Setup | 0 | 6424 | #!/usr/bin/env python3
import apt_pkg
import sys
from apt_pkg import CURSTATE_INSTALLED, version_compare
from operator import lt, le, eq, ge, gt
# Function mappings for relationship operators.
relation_operators = {"<<": lt, "<=": le, "=": eq, ">=": ge, ">>": gt}
# Set up APT cache.
apt_pkg.init()
cache = apt_pkg.Ca... | #!/usr/bin/env python3
import apt_pkg
import sys
from apt_pkg import CURSTATE_INSTALLED, version_compare
from operator import lt, le, eq, ge, gt
# Function mappings for relationship operators.
relation_operators = {"<<": lt, "<=": le, "=": eq, ">=": ge, ">>": gt}
# Set up APT cache.
apt_pkg.init()
cache = apt_pkg.Ca... | en | 0.902134 | #!/usr/bin/env python3 # Function mappings for relationship operators. # Set up APT cache. # Build the package relationship string for use by 'apt-get satisfy'. # Check if the package is in the cache. # Get the list of installed and provided packages that are currently installed. # If an installed package was found and... | 2.509684 | 3 |
cohorts_proj/datasets/migrations/0009_auto_20200824_0617.py | zferic/harmonization-website | 1 | 6425 | # Generated by Django 3.0.7 on 2020-08-24 06:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datasets', '0008_auto_20200821_1427'),
]
operations = [
migrations.AddField(
model_name='rawdar',
name='AsB',
... | # Generated by Django 3.0.7 on 2020-08-24 06:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datasets', '0008_auto_20200821_1427'),
]
operations = [
migrations.AddField(
model_name='rawdar',
name='AsB',
... | en | 0.797372 | # Generated by Django 3.0.7 on 2020-08-24 06:17 | 1.730105 | 2 |
test_hello.py | skvel/pynet_testx | 0 | 6426 | <gh_stars>0
print "Hello World!"
print "Trying my hand at Git!"
print "Something else"
for i in range(10):
print i
| print "Hello World!"
print "Trying my hand at Git!"
print "Something else"
for i in range(10):
print i | none | 1 | 2.97445 | 3 | |
tasks/views.py | TheDim0n/ProjectManager | 0 | 6427 | <reponame>TheDim0n/ProjectManager<filename>tasks/views.py<gh_stars>0
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic import DetailView, ListView
from projects.models import Project
from status.models import Sta... | from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic import DetailView, ListView
from projects.models import Project
from status.models import Status
from .models import Task
from .forms import TaskForm, FilterForm
... | none | 1 | 2.130247 | 2 | |
smoke/noaa/get_smokeplume_counts.py | minnieteng/smoke_project | 0 | 6428 | import os
import math
import time
import geohash
import geojson
from geojson import MultiLineString
from shapely import geometry
import shapefile
import numpy
import datetime as dt
import pandas as pd
import logging
logger = logging.getLogger(__name__)
source_shape_file_path = "C:/temp/2018/"
threshold = 60*60
cols = ... | import os
import math
import time
import geohash
import geojson
from geojson import MultiLineString
from shapely import geometry
import shapefile
import numpy
import datetime as dt
import pandas as pd
import logging
logger = logging.getLogger(__name__)
source_shape_file_path = "C:/temp/2018/"
threshold = 60*60
cols = ... | en | 0.987769 | # sometimes start is later than end time, we'll assume the earlier time is start | 2.31317 | 2 |
notes/OOBall/OOBall/main-demo.py | KRHS-GameProgramming-2015/Manpac | 0 | 6429 | import pygame_sdl2
pygame_sdl2.import_as_pygame()
import pygame
import os
import random
import math
from Ball import Ball
def save_state(balls):
"""
Saves the game state.
"""
stateString = ""
with open("state.txt", "w") as f:
for ball in balls:
stateString += "{} {} {} {} {}".f... | import pygame_sdl2
pygame_sdl2.import_as_pygame()
import pygame
import os
import random
import math
from Ball import Ball
def save_state(balls):
"""
Saves the game state.
"""
stateString = ""
with open("state.txt", "w") as f:
for ball in balls:
stateString += "{} {} {} {} {}".f... | en | 0.937678 | Saves the game state. #print infoObject.current_w # The app is about to go to sleep. It should save state, cancel # any timers, and stop drawing the screen until an APP_DIDENTERFOREGROUND # event shows up. # The app woke back up. Delete the saved state (we don't need it), # restore any times, and start drawing the scre... | 3.134801 | 3 |
sprt.py | vdbergh/pentanomial | 3 | 6430 | from __future__ import division
import math, copy
import argparse
from brownian import Brownian
import scipy
import LLRcalc
class sprt:
def __init__(self, alpha=0.05, beta=0.05, elo0=0, elo1=5, elo_model="logistic"):
assert elo_model in ("logistic", "normalized")
self.elo_model = elo_model
... | from __future__ import division
import math, copy
import argparse
from brownian import Brownian
import scipy
import LLRcalc
class sprt:
def __init__(self, alpha=0.05, beta=0.05, elo0=0, elo1=5, elo_model="logistic"):
assert elo_model in ("logistic", "normalized")
self.elo_model = elo_model
... | en | 0.898808 | "elo" is expressed in our current elo_model. For external use. "elo" is expressed in our current elo_model. "lelo" is logistic. # code duplication with LLRcalc # llr estimate # now normalize llr (if llr is not legal then the implications # of this are unclear) The probability of a test with the given elo with worse ou... | 2.727679 | 3 |
tools/hci_throughput/hci.py | t3zeng/mynewt-nimble | 0 | 6431 | <reponame>t3zeng/mynewt-nimble<filename>tools/hci_throughput/hci.py
#
# 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 ASF licenses this file
# to you ... | #
# 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 ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | en | 0.682529 | # # 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 ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not... | 1.25806 | 1 |
examples/dataproc/query.py | populationgenomics/analysis-runner | 0 | 6432 | """Simple Hail query example."""
import click
import hail as hl
from bokeh.io.export import get_screenshot_as_png
from analysis_runner import output_path
GNOMAD_HGDP_1KG_MT = (
'gs://gcp-public-data--gnomad/release/3.1/mt/genomes/'
'gnomad.genomes.v3.1.hgdp_1kg_subset_dense.mt'
)
@click.command()
@click.op... | """Simple Hail query example."""
import click
import hail as hl
from bokeh.io.export import get_screenshot_as_png
from analysis_runner import output_path
GNOMAD_HGDP_1KG_MT = (
'gs://gcp-public-data--gnomad/release/3.1/mt/genomes/'
'gnomad.genomes.v3.1.hgdp_1kg_subset_dense.mt'
)
@click.command()
@click.op... | en | 0.476273 | Simple Hail query example. Query script entry point. # pylint: disable=no-value-for-parameter | 2.504217 | 3 |
ptpip/ptpip.py | darkarnium/ptpip | 0 | 6433 | <filename>ptpip/ptpip.py
import uuid
import time
import socket
import struct
class PtpIpConnection(object):
"""docstring for PtpIP"""
def __init__(self):
super(PtpIpConnection, self).__init__()
self.session = None
self.session_events = None
self.session_id = None
self.... | <filename>ptpip/ptpip.py
import uuid
import time
import socket
import struct
class PtpIpConnection(object):
"""docstring for PtpIP"""
def __init__(self):
super(PtpIpConnection, self).__init__()
self.session = None
self.session_events = None
self.session_id = None
self.... | en | 0.538234 | docstring for PtpIP # Open both session, first one for for commands, second for events # 0x1002 OpenSession # do a ping receive a pong (same as ping) as reply to keep the connection alive # couldnt get any reply onto a propper PtpIpPing packet so i am querying the status # of the device # get the next command from comm... | 2.883045 | 3 |
examples/morpho.py | jaideep-seth/PyOpenWorm | 0 | 6434 | <gh_stars>0
"""
How to load morphologies of certain cells from the database.
"""
#this is an expected failure right now, as morphology is not implemented
from __future__ import absolute_import
from __future__ import print_function
import PyOpenWorm as P
from PyOpenWorm.context import Context
from PyOpenWorm.worm import... | """
How to load morphologies of certain cells from the database.
"""
#this is an expected failure right now, as morphology is not implemented
from __future__ import absolute_import
from __future__ import print_function
import PyOpenWorm as P
from PyOpenWorm.context import Context
from PyOpenWorm.worm import Worm
from ... | en | 0.917473 | How to load morphologies of certain cells from the database. #this is an expected failure right now, as morphology is not implemented #Connect to database. #Create a new Cell object to work with. #Get the morphology associated with the Cell. Returns a neuroml.Morphology object. # we're printing it here, but we would no... | 2.585771 | 3 |
corehq/apps/app_manager/tests/test_form_workflow.py | kkrampa/commcare-hq | 1 | 6435 | <reponame>kkrampa/commcare-hq
from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import SimpleTestCase
from corehq.apps.app_manager.const import (
AUTO_SELECT_RAW,
AUTO_SELECT_CASE,
WORKFLOW_FORM,
WORKFLOW_MODULE,
WORKFLOW_PREVIOUS,
WORKFLOW_ROOT,
... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import SimpleTestCase
from corehq.apps.app_manager.const import (
AUTO_SELECT_RAW,
AUTO_SELECT_CASE,
WORKFLOW_FORM,
WORKFLOW_MODULE,
WORKFLOW_PREVIOUS,
WORKFLOW_ROOT,
WORKFLOW_PARENT_MODULE,
)
fr... | en | 0.510088 | # http://manage.dimagi.com/default.asp?236750 # # Stack create blocks do not update the session after each datum # so items put into the session in one step aren't available later steps # # <datum id="case_id_A" value="instance('commcaresession')/session/data/case_id_new_A"/> # - <datum id="case_id_B" value="instan... | 1.974956 | 2 |
tensorflow/python/compiler/tensorrt/model_tests/model_handler.py | sboshin/tensorflow | 0 | 6436 | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | en | 0.751523 | # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica... | 1.518926 | 2 |
Python/Python Evaluation/solution.py | arpitran/HackerRank_solutions | 0 | 6437 | <filename>Python/Python Evaluation/solution.py
eval(input("Enter a expression ")) | <filename>Python/Python Evaluation/solution.py
eval(input("Enter a expression ")) | none | 1 | 2.383035 | 2 | |
kpca_iris.py | syamkakarla98/Kernel-PCA-Using-Different-Kernels-With-Classification | 10 | 6438 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# load dataset into Pandas DataFrame
df = pd.read_csv("D:\Python_programs\ML\Iris Data\KPCA\iris.csv")
#df.to_csv('iris.csv')
from sklearn.preprocessing import StandardScaler
features = ['sepal length', 'sepal width', 'petal length... | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# load dataset into Pandas DataFrame
df = pd.read_csv("D:\Python_programs\ML\Iris Data\KPCA\iris.csv")
#df.to_csv('iris.csv')
from sklearn.preprocessing import StandardScaler
features = ['sepal length', 'sepal width', 'petal length', 'petal width... | en | 0.295195 | # load dataset into Pandas DataFrame #df.to_csv('iris.csv') # Separating out the features # Separating out the target # Standardizing the features ## Finding the principle components # KERNELS : linear,rbf,poly # #--------- Bar Graph for Explained Variance Ratio ------------ #---------------------- #-----------------... | 3.448327 | 3 |
Python/libraries/recognizers-date-time/recognizers_date_time/date_time/italian/dateperiod_extractor_config.py | felaray/Recognizers-Text | 0 | 6439 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List, Pattern
from recognizers_text.utilities import RegExpUtility
from recognizers_number.number import BaseNumberParser
from recognizers_number.number.italian.extractors import ItalianIntegerExtractor,... | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List, Pattern
from recognizers_text.utilities import RegExpUtility
from recognizers_number.number import BaseNumberParser
from recognizers_number.number.italian.extractors import ItalianIntegerExtractor,... | en | 0.841026 | # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # TODO When the implementation for these properties is added, change the None values to their respective Regexps | 2.295274 | 2 |
pydbrepo/drivers/sqlite.py | danteay/pydbrepo | 2 | 6440 | <filename>pydbrepo/drivers/sqlite.py
"""SQLite Driver implementation."""
# pylint: disable=R0201
import os
import sqlite3
from typing import Any, AnyStr, List, NoReturn, Optional, Tuple
from pydbrepo.drivers.driver import Driver
class SQLite(Driver):
"""SQLite Driver connection class.
Environment variable... | <filename>pydbrepo/drivers/sqlite.py
"""SQLite Driver implementation."""
# pylint: disable=R0201
import os
import sqlite3
from typing import Any, AnyStr, List, NoReturn, Optional, Tuple
from pydbrepo.drivers.driver import Driver
class SQLite(Driver):
"""SQLite Driver connection class.
Environment variable... | en | 0.596851 | SQLite Driver implementation. # pylint: disable=R0201 SQLite Driver connection class. Environment variables: DATABASE_URL: Database file ulr on the system. If it's an in memory database the url should be None or `:memory:` string DATABASE_COMMIT: default('false') Auto commit transactio... | 3.093011 | 3 |
Modules/BatchNormND.py | EmilPi/PuzzleLib | 52 | 6441 | <reponame>EmilPi/PuzzleLib
import numpy as np
from PuzzleLib import Config
from PuzzleLib.Backend import gpuarray, Blas
from PuzzleLib.Backend.Dnn import batchNormNd, batchNormNdBackward
from PuzzleLib.Variable import Variable
from PuzzleLib.Modules.Module import ModuleError, Module
class BatchNormND(Module):
def... | import numpy as np
from PuzzleLib import Config
from PuzzleLib.Backend import gpuarray, Blas
from PuzzleLib.Backend.Dnn import batchNormNd, batchNormNdBackward
from PuzzleLib.Variable import Variable
from PuzzleLib.Modules.Module import ModuleError, Module
class BatchNormND(Module):
def __init__(self, nd, maps, e... | none | 1 | 2.233412 | 2 | |
python/testData/editing/enterInIncompleteTupleLiteral.after.py | jnthn/intellij-community | 2 | 6442 | <filename>python/testData/editing/enterInIncompleteTupleLiteral.after.py
xs = ('foo', 'bar',
'baz'<caret> | <filename>python/testData/editing/enterInIncompleteTupleLiteral.after.py
xs = ('foo', 'bar',
'baz'<caret> | none | 1 | 1.345488 | 1 | |
model/server/server.py | waltzofpearls/reckon | 8 | 6443 | <reponame>waltzofpearls/reckon<filename>model/server/server.py
from concurrent import futures
from forecaster.prophet import Forecaster as ProphetForecaster
from multiprocessing import Event, Process, cpu_count
from pythonjsonlogger import jsonlogger
import contextlib
import grpc
import logging
import model.api.forecas... | from concurrent import futures
from forecaster.prophet import Forecaster as ProphetForecaster
from multiprocessing import Event, Process, cpu_count
from pythonjsonlogger import jsonlogger
import contextlib
import grpc
import logging
import model.api.forecast_pb2_grpc as grpc_lib
import os
import signal
import socket
im... | en | 0.92082 | Find and reserve a port for all subprocesses to use # Send SIGINT if process doesn't exit quickly enough, and kill it as last resort # .is_alive() also implicitly joins the process (good practice in linux) # Queues and other inter-process communication primitives can break when # process is killed, but we don't care he... | 2.26554 | 2 |
test/test_setupcall.py | jhgoebbert/jupyter-libertem-proxy | 0 | 6444 | def test_setupcall():
"""
Test the call of the setup function
"""
import jupyter_libertem_proxy as jx
print("\nRunning test_setupcall...")
print(jx.setup_libertem())
| def test_setupcall():
"""
Test the call of the setup function
"""
import jupyter_libertem_proxy as jx
print("\nRunning test_setupcall...")
print(jx.setup_libertem())
| en | 0.611143 | Test the call of the setup function | 2.028706 | 2 |
launchpad/launch/worker_manager.py | LaudateCorpus1/launchpad | 0 | 6445 | <gh_stars>0
# Copyright 2020 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | # Copyright 2020 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | en | 0.870636 | # Copyright 2020 DeepMind Technologies Limited. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ... | 2.571431 | 3 |
mmdeploy/backend/tensorrt/init_plugins.py | hanrui1sensetime/mmdeploy | 1 | 6446 | <gh_stars>1-10
# Copyright (c) OpenMMLab. All rights reserved.
import ctypes
import glob
import logging
import os
def get_ops_path() -> str:
"""Get path of the TensorRT plugin library.
Returns:
str: A path of the TensorRT plugin library.
"""
wildcard = os.path.abspath(
os.path.join(
... | # Copyright (c) OpenMMLab. All rights reserved.
import ctypes
import glob
import logging
import os
def get_ops_path() -> str:
"""Get path of the TensorRT plugin library.
Returns:
str: A path of the TensorRT plugin library.
"""
wildcard = os.path.abspath(
os.path.join(
os.p... | en | 0.821414 | # Copyright (c) OpenMMLab. All rights reserved. Get path of the TensorRT plugin library. Returns: str: A path of the TensorRT plugin library. Load TensorRT plugins library. Returns: bool: True if TensorRT plugin library is successfully loaded. | 2.322663 | 2 |
reagent/test/world_model/test_seq2reward.py | dmitryvinn/ReAgent | 0 | 6447 | <reponame>dmitryvinn/ReAgent
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import os
import random
import unittest
from typing import Optional
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from parameterized import ... | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import os
import random
import unittest
from typing import Optional
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from parameterized import parameterized
from reagent.co... | en | 0.828508 | #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. Given the current state, predict the probability of experiencing next n steps (1 <=n <= look_ahead_steps) For the test purpose, it outputs fixed fake numbers Mimic I/O of Seq2RewardNetwork but return fake rew... | 2.003592 | 2 |
models_SHOT_convex/syn30m03hfsg.py | grossmann-group/pyomo-MINLP-benchmarking | 0 | 6448 | <gh_stars>0
# MINLP written by GAMS Convert at 01/15/21 11:37:33
#
# Equation counts
# Total E G L N X C B
# 1486 571 111 804 0 0 0 0
#
# Variable counts
# x b i s1s s2... | # MINLP written by GAMS Convert at 01/15/21 11:37:33
#
# Equation counts
# Total E G L N X C B
# 1486 571 111 804 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | en | 0.732865 | # MINLP written by GAMS Convert at 01/15/21 11:37:33 # # Equation counts # Total E G L N X C B # 1486 571 111 804 0 0 0 0 # # Variable counts # x b i s1s s2s sc ... | 1.539076 | 2 |
backend/tests/test_resources.py | sartography/star-drive | 0 | 6449 | <reponame>sartography/star-drive
import unittest
from flask import json
from tests.base_test import BaseTest
from app import db, elastic_index
from app.model.resource import Resource
from app.model.resource_category import ResourceCategory
from app.model.resource_change_log import ResourceChangeLog
from app.model.use... | import unittest
from flask import json
from tests.base_test import BaseTest
from app import db, elastic_index
from app.model.resource import Resource
from app.model.resource_category import ResourceCategory
from app.model.resource_change_log import ResourceChangeLog
from app.model.user import Role
class TestResourc... | none | 1 | 2.396804 | 2 | |
kolibri/core/auth/management/commands/sync.py | reubenjacob/kolibri | 0 | 6450 | <filename>kolibri/core/auth/management/commands/sync.py
import json
import logging
import math
import re
from contextlib import contextmanager
from django.core.management import call_command
from django.core.management.base import CommandError
from morango.models import Filter
from morango.models import InstanceIDMode... | <filename>kolibri/core/auth/management/commands/sync.py
import json
import logging
import math
import re
from contextlib import contextmanager
from django.core.management import call_command
from django.core.management.base import CommandError
from morango.models import Filter
from morango.models import InstanceIDMode... | en | 0.745439 | # parser.add_argument("--scope-id", type=str, default=FULL_FACILITY) # noqa C901 # validate url that is passed in # call this in case user directly syncs without migrating database # try to connect to server # if instance_ids are equal, this means device is trying to sync with itself, which we don't allow # it's a sing... | 1.721366 | 2 |
warp.py | RezaFirouzii/fum-delta-vision | 0 | 6451 | import math
import imageio
import cv2 as cv
import numpy as np
import transformer
def fix_rotation(img):
img_copy = img.copy()
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
rows, cols = img.shape
img = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY_INV, 15, 9)
kernel = cv.g... | import math
import imageio
import cv2 as cv
import numpy as np
import transformer
def fix_rotation(img):
img_copy = img.copy()
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
rows, cols = img.shape
img = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY_INV, 15, 9)
kernel = cv.g... | en | 0.238096 | # src = np.reshape(src, (len(src), 1, 2)) # perimeter = cv.arcLength(src, True) # corners = cv.approxPolyDP(src, perimeter // 10, True) # corners = np.vstack(corners) # frame = cv.adaptiveThreshold(frame, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY_INV, 15, 9) # kernel = cv.getStructuringElement(cv.MORPH_ELLIPSE, ... | 2.402738 | 2 |
sdssobstools/boss_data.py | sdss/ObserverTools | 0 | 6452 | <reponame>sdss/ObserverTools<filename>sdssobstools/boss_data.py
#!/usr/bin/env python3
"""
A tool to grab a single BOSS image and pull a few items from its header. It is
used in bin/sloan_log.py, but it could be used directly as well.
"""
import argparse
from pathlib import Path
from astropy.time import Time
import fi... | #!/usr/bin/env python3
"""
A tool to grab a single BOSS image and pull a few items from its header. It is
used in bin/sloan_log.py, but it could be used directly as well.
"""
import argparse
from pathlib import Path
from astropy.time import Time
import fitsio
class BOSSRaw:
"""A class to parse raw data from APOG... | en | 0.907511 | #!/usr/bin/env python3 A tool to grab a single BOSS image and pull a few items from its header. It is used in bin/sloan_log.py, but it could be used directly as well. A class to parse raw data from APOGEE. The purpose of collecting this raw data is to future-proof things that need these ouptuts in case things ... | 2.462294 | 2 |
capitulo-08/ex13b.py | bryan-lima/exercicios-livro-introd-prog-python-3ed | 3 | 6453 | # Altere o Programa 8.20 de forma que o usuário tenha três chances de acertar o número
# O programa termina se o usuário acertar ou errar três vezes
# Programa 8.20 do livro, página 184
# Programa 8.20 - Adivinhando o número
#
# import random
#
# n = random.randint(1, 10)
# x = int(input('Escolha um número entre 1 e 1... | # Altere o Programa 8.20 de forma que o usuário tenha três chances de acertar o número
# O programa termina se o usuário acertar ou errar três vezes
# Programa 8.20 do livro, página 184
# Programa 8.20 - Adivinhando o número
#
# import random
#
# n = random.randint(1, 10)
# x = int(input('Escolha um número entre 1 e 1... | pt | 0.930742 | # Altere o Programa 8.20 de forma que o usuário tenha três chances de acertar o número # O programa termina se o usuário acertar ou errar três vezes # Programa 8.20 do livro, página 184 # Programa 8.20 - Adivinhando o número # # import random # # n = random.randint(1, 10) # x = int(input('Escolha um número entre 1 e 10... | 4.094202 | 4 |
slogviz/config.py | mariusfrinken/slogviz | 1 | 6454 | <reponame>mariusfrinken/slogviz
# -*- coding: utf-8 -*-
"""This sub module provides a global variable to check for checking if the non-interactive argument was set
Exported variable:
interactive -- False, if the main the non-interactive argument was set, True, if it was not set
"""
global interactive
interactive = ... | # -*- coding: utf-8 -*-
"""This sub module provides a global variable to check for checking if the non-interactive argument was set
Exported variable:
interactive -- False, if the main the non-interactive argument was set, True, if it was not set
"""
global interactive
interactive = True; | en | 0.82313 | # -*- coding: utf-8 -*- This sub module provides a global variable to check for checking if the non-interactive argument was set Exported variable: interactive -- False, if the main the non-interactive argument was set, True, if it was not set | 1.726203 | 2 |
setup.py | shb84/ATM76 | 0 | 6455 | import setuptools
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name="atm76",
version="0.1.0",
author="<NAME>",
a... | import setuptools
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name="atm76",
version="0.1.0",
author="<NAME>",
a... | en | 0.42673 | # To use a consistent encoding | 1.639094 | 2 |
agent/check_plugins/download_speed.py | indigos33k3r/god-eye | 1 | 6456 | import logging
import asyncio
from agent.check_plugins import AbstractCheckPlugin
# Do khong biet dung thu vien asyncio ntn ca nen em dung thu vien request
# python
import requests
import sys
import time
from datetime import datetime
logger = logging.getLogger(__name__)
class Download(AbstractCheckPlugin):
@as... | import logging
import asyncio
from agent.check_plugins import AbstractCheckPlugin
# Do khong biet dung thu vien asyncio ntn ca nen em dung thu vien request
# python
import requests
import sys
import time
from datetime import datetime
logger = logging.getLogger(__name__)
class Download(AbstractCheckPlugin):
@as... | en | 0.650971 | # Do khong biet dung thu vien asyncio ntn ca nen em dung thu vien request # python # 1kB1024 1MB 1048576 # kB / s Download and processing data. Args: url (str): url file download. start (float): It's time which started download. end (float): It's time which finished downloa... | 2.382754 | 2 |
Setup Rich Text Editor/mysite/main/urls.py | AyemunHossain/Django | 2 | 6457 | <reponame>AyemunHossain/Django
from django.urls import path
from . import views
app_name = "main"
urlpatterns = [
path("",views.homepage,name="homepage")
] | from django.urls import path
from . import views
app_name = "main"
urlpatterns = [
path("",views.homepage,name="homepage")
] | none | 1 | 1.640069 | 2 | |
GA/train.py | jcordell/keras-optimization | 1 | 6458 | <gh_stars>1-10
"""
Utility used by the Network class to actually train.
Based on:
https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py
"""
from keras.datasets import mnist, cifar10
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.utils.np_utils import to_catego... | """
Utility used by the Network class to actually train.
Based on:
https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py
"""
from keras.datasets import mnist, cifar10
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.utils.np_utils import to_categorical
from kera... | en | 0.622116 | Utility used by the Network class to actually train. Based on: https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py # Helper: Early stopping. Retrieve the CIFAR dataset and process the data. # Set defaults. # Get the data. # convert class vectors to binary class matrices Retrieve the MNIST dataset a... | 3.491458 | 3 |
tests/integration/agenda/test_models.py | rolandgeider/OpenSlides | 0 | 6459 | <reponame>rolandgeider/OpenSlides
from openslides.agenda.models import Item
from openslides.core.models import CustomSlide
from openslides.utils.test import TestCase
class TestItemManager(TestCase):
def test_get_root_and_children_db_queries(self):
"""
Test that get_root_and_children needs only one... | from openslides.agenda.models import Item
from openslides.core.models import CustomSlide
from openslides.utils.test import TestCase
class TestItemManager(TestCase):
def test_get_root_and_children_db_queries(self):
"""
Test that get_root_and_children needs only one db query.
"""
for... | en | 0.89224 | Test that get_root_and_children needs only one db query. | 2.193177 | 2 |
ssl_context_builder/http_impl/requests_wrapper/secure_session.py | mbjahnoon/ssl_context_builder | 1 | 6460 | import weakref
import os
import requests
import ssl
from ssl import SSLContext
import logging
from ssl_context_builder.builder.builder import SslContextBuilder
from ssl_context_builder.http_impl.requests_wrapper.ssl_adapter import SslAdapter
class RequestsSecureSession:
def __init__(self, ssl_context: SSLContex... | import weakref
import os
import requests
import ssl
from ssl import SSLContext
import logging
from ssl_context_builder.builder.builder import SslContextBuilder
from ssl_context_builder.http_impl.requests_wrapper.ssl_adapter import SslAdapter
class RequestsSecureSession:
def __init__(self, ssl_context: SSLContex... | en | 0.886235 | This class create a wrapper for the requests.Session object It does the following: 1. Disable session env_vars consuming 2. Load certificates provided with the ssl_context 3. Except ssl_context to control the TLS communication @param ssl_context: SSLContext # see note inside the ... | 2.48199 | 2 |
tiny_scripts/select_cifar_10.py | jiaqiangwjq/python_workhouse | 0 | 6461 | <reponame>jiaqiangwjq/python_workhouse
'''
Selected cifar-10. The .csv file format:
class_index,data_index
3,0
8,1
8,2
...
'''
import pickle
import pandas as pd
file = 'E:\pycharm\LEARN\data\cifar-10\cifar-10-batches-py\\test_batch'
with open(file, 'rb') as f:
dict = pickle.load(f, encoding='bytes')
dict.keys... | '''
Selected cifar-10. The .csv file format:
class_index,data_index
3,0
8,1
8,2
...
'''
import pickle
import pandas as pd
file = 'E:\pycharm\LEARN\data\cifar-10\cifar-10-batches-py\\test_batch'
with open(file, 'rb') as f:
dict = pickle.load(f, encoding='bytes')
dict.keys()
batch_label = dict[b'batch_label']
... | en | 0.303278 | Selected cifar-10. The .csv file format: class_index,data_index 3,0 8,1 8,2 ... | 3.125132 | 3 |
codebox/scripts/fixture.py | disqus/codebox | 5 | 6462 | # Ghetto Fixtures
from codebox import app
from codebox.apps.auth.models import User
from codebox.apps.snippets.models import Snippet
from codebox.apps.organizations.models import Organization, OrganizationMember
from flask import g
client = app.test_client()
_ctx = app.test_request_context()
_ctx.push()
app.preproces... | # Ghetto Fixtures
from codebox import app
from codebox.apps.auth.models import User
from codebox.apps.snippets.models import Snippet
from codebox.apps.organizations.models import Organization, OrganizationMember
from flask import g
client = app.test_client()
_ctx = app.test_request_context()
_ctx.push()
app.preproces... | en | 0.565044 | # Ghetto Fixtures # Create sample snippets # plaintext # python # html # javascript | 2.234074 | 2 |
corehq/apps/linked_domain/tests/test_views.py | akashkj/commcare-hq | 0 | 6463 | <filename>corehq/apps/linked_domain/tests/test_views.py
from unittest.mock import Mock, patch
from django.test import SimpleTestCase
from corehq.apps.domain.exceptions import DomainDoesNotExist
from corehq.apps.linked_domain.exceptions import (
DomainLinkAlreadyExists,
DomainLinkError,
DomainLinkNotAllowe... | <filename>corehq/apps/linked_domain/tests/test_views.py
from unittest.mock import Mock, patch
from django.test import SimpleTestCase
from corehq.apps.domain.exceptions import DomainDoesNotExist
from corehq.apps.linked_domain.exceptions import (
DomainLinkAlreadyExists,
DomainLinkError,
DomainLinkNotAllowe... | none | 1 | 2.324025 | 2 | |
LanguageBasics/functions/import_eg.py | Vamsi-TM/jubilant-train | 0 | 6464 | import function_exercise_01 as st
st.sandwich_toppings('meatballs', 'salad')
| import function_exercise_01 as st
st.sandwich_toppings('meatballs', 'salad')
| none | 1 | 1.059498 | 1 | |
pyingest/parsers/zenodo.py | golnazads/adsabs-pyingest | 1 | 6465 | <reponame>golnazads/adsabs-pyingest
#!/usr/bin/python
#
#
from __future__ import absolute_import
import json
import re
import logging
from .datacite import DataCiteParser
class WrongPublisherException(Exception):
pass
class ZenodoParser(DataCiteParser):
def get_references(self, r):
# as of version... | #!/usr/bin/python
#
#
from __future__ import absolute_import
import json
import re
import logging
from .datacite import DataCiteParser
class WrongPublisherException(Exception):
pass
class ZenodoParser(DataCiteParser):
def get_references(self, r):
# as of version 3.1 of datacite schema, "References... | en | 0.675891 | #!/usr/bin/python # # # as of version 3.1 of datacite schema, "References" is not an # allowed description type so Lars is shoving the references # in a section labeled as "Other" as a json structure # XXX not supported yet, but one can only hope... Parses Zenodo's flavor of DataCite 3.1 schema, returns ADS tagged form... | 2.056481 | 2 |
src/fullnode.py | AmeyaDaddikar/vjtichain | 1 | 6466 | import json
import time
from functools import lru_cache
from multiprocessing import Pool, Process
from threading import Thread, Timer
from typing import Any, Dict, List
from datetime import datetime
import hashlib
import inspect
import requests
import waitress
from bottle import BaseTemplate, Bottle, request, response,... | import json
import time
from functools import lru_cache
from multiprocessing import Pool, Process
from threading import Thread, Timer
from typing import Any, Dict, List
from datetime import datetime
import hashlib
import inspect
import requests
import waitress
from bottle import BaseTemplate, Bottle, request, response,... | en | 0.662952 | # Send a POST request to the peer # Update the peer data in the peer list with the new data received from the peer. # Periodically sync with all the peers # Check if block already exists # Broadcast block to other peers # TODO Make new chain/ orphan set for Block that is not added # Kill Miner # Add transaction to Memp... | 2.065603 | 2 |
deepexplain/tf/v1_x/main.py | alexus37/MasterThesisCode | 1 | 6467 | <filename>deepexplain/tf/v1_x/main.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import ops
from collections import OrderedDict
import warnings, logging
from deepexplain.tf.v1_x import constants
... | <filename>deepexplain/tf/v1_x/main.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import ops
from collections import OrderedDict
import warnings, logging
from deepexplain.tf.v1_x import constants
... | en | 0.807764 | # constants._ENABLED_METHOD_CLASS, _GRAD_OVERRIDE_CHECKFLAG # Override gradient of all ops created in context # global constants._ENABLED_METHOD_CLASS, _GRAD_OVERRIDE_CHECKFLAG # logging.info('DeepExplain: running "%s" explanation method (%d)' % (self.method, method_flag)) Heuristically check if any op is in the list o... | 2.057816 | 2 |
util/mem_usage.py | robinupham/cnn_lensing | 0 | 6468 | <gh_stars>0
"""
Get the memory usage of a Keras model.
From https://stackoverflow.com/a/46216013.
"""
def get_model_memory_usage(batch_size, model):
"""
Get the memory usage of a Keras model in GB.
From https://stackoverflow.com/a/46216013.
"""
import numpy as np
try:
from keras impo... | """
Get the memory usage of a Keras model.
From https://stackoverflow.com/a/46216013.
"""
def get_model_memory_usage(batch_size, model):
"""
Get the memory usage of a Keras model in GB.
From https://stackoverflow.com/a/46216013.
"""
import numpy as np
try:
from keras import backend a... | en | 0.659083 | Get the memory usage of a Keras model. From https://stackoverflow.com/a/46216013. Get the memory usage of a Keras model in GB. From https://stackoverflow.com/a/46216013. | 2.932629 | 3 |
hexrd/distortion/distortionabc.py | glemaitre/hexrd | 27 | 6469 | import abc
class DistortionABC(metaclass=abc.ABCMeta):
maptype = None
@abc.abstractmethod
def apply(self, xy_in):
"""Apply distortion mapping"""
pass
@abc.abstractmethod
def apply_inverse(self, xy_in):
"""Apply inverse distortion mapping"""
pass
| import abc
class DistortionABC(metaclass=abc.ABCMeta):
maptype = None
@abc.abstractmethod
def apply(self, xy_in):
"""Apply distortion mapping"""
pass
@abc.abstractmethod
def apply_inverse(self, xy_in):
"""Apply inverse distortion mapping"""
pass
| en | 0.57119 | Apply distortion mapping Apply inverse distortion mapping | 3.086508 | 3 |
setup.py | statisticianinstilettos/recommender_metrics | 0 | 6470 | import io
import os
from setuptools import setup
def read(file_name):
"""Read a text file and return the content as a string."""
with io.open(os.path.join(os.path.dirname(__file__), file_name),
encoding='utf-8') as f:
return f.read()
setup(
name='recmetrics',
url='https://gi... | import io
import os
from setuptools import setup
def read(file_name):
"""Read a text file and return the content as a string."""
with io.open(os.path.join(os.path.dirname(__file__), file_name),
encoding='utf-8') as f:
return f.read()
setup(
name='recmetrics',
url='https://gi... | en | 0.940884 | Read a text file and return the content as a string. | 2.628932 | 3 |
run_classifier.py | wj-Mcat/model-getting-started | 0 | 6471 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... | en | 0.801735 | # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ... | 1.994238 | 2 |
module2-sql-for-analysis/rpg_db.py | TobyChen320/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 6472 | <reponame>TobyChen320/DS-Unit-3-Sprint-2-SQL-and-Databases
import sqlite3
import os
import psycopg2
from dotenv import load_dotenv
load_dotenv()
DB_NAME2 = os.getenv("DB_NAME3")
DB_USER2 = os.getenv("DB_USER3")
DB_PASS2 = os.getenv("DB_PASS3")
DB_HOST2 = os.getenv("DB_HOST3")
conn = psycopg2.connect(dbname=DB_NAME2,... | import sqlite3
import os
import psycopg2
from dotenv import load_dotenv
load_dotenv()
DB_NAME2 = os.getenv("DB_NAME3")
DB_USER2 = os.getenv("DB_USER3")
DB_PASS2 = os.getenv("DB_PASS3")
DB_HOST2 = os.getenv("DB_HOST3")
conn = psycopg2.connect(dbname=DB_NAME2,
user=DB_USER2,
... | en | 0.741478 | CREATE TABLE IF NOT EXISTS rpg_characters ( character_id SERIAL PRIMARY KEY, name VARCHAR(30), level INT, exp INT, hp INT, strength INT, intelligence INT, dexterity INT, wisdom INT ) INSERT INTO rpg_characters (character_id, name, level, exp, hp, strength, intelligence, dexterity, wisdom) VALUES ... | 2.967295 | 3 |
sws_comp_wiki_gen.py | moff-wildfire/sws-battlefy | 1 | 6473 | <reponame>moff-wildfire/sws-battlefy
import battlefy_data
import battlefy_wiki_linkings
from datetime import datetime
from operator import itemgetter
from pathlib import Path
import calcup_roster_tracking
def create_sidebar(data, wiki_name):
sidebar = '{{Infobox league' + '\n'
sidebar += '|liquipediatier=' +... | import battlefy_data
import battlefy_wiki_linkings
from datetime import datetime
from operator import itemgetter
from pathlib import Path
import calcup_roster_tracking
def create_sidebar(data, wiki_name):
sidebar = '{{Infobox league' + '\n'
sidebar += '|liquipediatier=' + '\n'
sidebar += '|name=' + data[... | en | 0.742184 | # Use prior rounds as a tiebreaker for when multiple teams have the same place at the end # teams_table += '|c= |cflag=\n' # teams_table += '|qualifier=\n' # todo handle double elimination brackets # set up team number trackers # set up round-match count trackers # matches = sorted(stage['matches'], key=itemgetter('mat... | 2.281273 | 2 |
utilidades/texto.py | DeadZombie14/chillMagicCarPygame | 0 | 6474 | import pygame
class Texto:
def __init__(self, screen, text, x, y, text_size = 20, fuente = 'Calibri', italic = False, bold= False, subrayado= False, color = (250, 240, 230), bg = [] ):
self.screen = screen
fg = color
self.coord = x, y
#load font, prepare values
f... | import pygame
class Texto:
def __init__(self, screen, text, x, y, text_size = 20, fuente = 'Calibri', italic = False, bold= False, subrayado= False, color = (250, 240, 230), bg = [] ):
self.screen = screen
fg = color
self.coord = x, y
#load font, prepare values
f... | en | 0.246298 | #load font, prepare values # Font # Cursiva # Negritas # Subrayado # Construccion del texto # Si hay fondo de texto # Si no, transparente # self.size = x+size[0], y # Cursiva # Negritas # Subrayado # self.image.blit(ren, self.text_rect) # self.text_rect = (x, y),ren.get_size() # text = str(self.counter) # label = self.... | 3.160388 | 3 |
training_xgboost_model.py | MighTy-Weaver/Inefficient-AC-detection | 2 | 6475 | # This is the code to train the xgboost model with cross-validation for each unique room in the dataset.
# Models are dumped into ./models and results are dumped into two csv files in the current work directory.
import argparse
import json
import math
import os
import pickle
import warnings
from typing import Tuple
i... | # This is the code to train the xgboost model with cross-validation for each unique room in the dataset.
# Models are dumped into ./models and results are dumped into two csv files in the current work directory.
import argparse
import json
import math
import os
import pickle
import warnings
from typing import Tuple
i... | en | 0.869335 | # This is the code to train the xgboost model with cross-validation for each unique room in the dataset. # Models are dumped into ./models and results are dumped into two csv files in the current work directory. # Set up an argument parser to decide the metric function # Ignore all the warnings and set pandas to displa... | 2.739273 | 3 |
setup.py | editorconfig/editorconfig-core-py | 70 | 6476 | import os
from setuptools import setup
# Read the version
g = {}
with open(os.path.join("editorconfig", "version.py"), "rt") as fp:
exec(fp.read(), g)
v = g['VERSION']
version = ".".join(str(x) for x in v[:3])
if v[3] != "final":
version += "-" + v[3]
setup(
name='EditorConfig',
versio... | import os
from setuptools import setup
# Read the version
g = {}
with open(os.path.join("editorconfig", "version.py"), "rt") as fp:
exec(fp.read(), g)
v = g['VERSION']
version = ".".join(str(x) for x in v[:3])
if v[3] != "final":
version += "-" + v[3]
setup(
name='EditorConfig',
versio... | en | 0.752604 | # Read the version | 1.778188 | 2 |
vaping/config.py | josephburnett/vaping | 0 | 6477 | <filename>vaping/config.py<gh_stars>0
import re
import munge
def parse_interval(val):
"""
converts a string to float of seconds
.5 = 500ms
90 = 1m30s
**Arguments**
- val (`str`)
"""
re_intv = re.compile(r"([\d\.]+)([a-zA-Z]+)")
val = val.strip()
total = 0.0
for ... | <filename>vaping/config.py<gh_stars>0
import re
import munge
def parse_interval(val):
"""
converts a string to float of seconds
.5 = 500ms
90 = 1m30s
**Arguments**
- val (`str`)
"""
re_intv = re.compile(r"([\d\.]+)([a-zA-Z]+)")
val = val.strip()
total = 0.0
for ... | en | 0.383769 | converts a string to float of seconds .5 = 500ms 90 = 1m30s **Arguments** - val (`str`) Vaping config manager | 2.885638 | 3 |
sktime/annotation/tests/test_all_annotators.py | Rubiel1/sktime | 1 | 6478 | # -*- coding: utf-8 -*-
"""Tests for sktime annotators."""
import pandas as pd
import pytest
from sktime.registry import all_estimators
from sktime.utils._testing.estimator_checks import _make_args
ALL_ANNOTATORS = all_estimators(estimator_types="series-annotator", return_names=False)
@pytest.mark.parametrize("Est... | # -*- coding: utf-8 -*-
"""Tests for sktime annotators."""
import pandas as pd
import pytest
from sktime.registry import all_estimators
from sktime.utils._testing.estimator_checks import _make_args
ALL_ANNOTATORS = all_estimators(estimator_types="series-annotator", return_names=False)
@pytest.mark.parametrize("Est... | en | 0.648945 | # -*- coding: utf-8 -*- Tests for sktime annotators. Test annotator output type. | 2.373665 | 2 |
raspberry-pi-camera/cam.py | AlexMassin/mlh-react-vr-website | 1 | 6479 | <gh_stars>1-10
picamera import PiCamera
from time import sleep
import boto3
import os.path
import subprocess
s3 = boto3.client('s3')
bucket = 'cambucket21'
camera = PiCamera()
#camera.resolution(1920,1080)
x = 0
camerafile = x
while True:
if (x == 6):
x = 1
else:
x = x + 1
camera.start_preview()
camera.start_recordi... | picamera import PiCamera
from time import sleep
import boto3
import os.path
import subprocess
s3 = boto3.client('s3')
bucket = 'cambucket21'
camera = PiCamera()
#camera.resolution(1920,1080)
x = 0
camerafile = x
while True:
if (x == 6):
x = 1
else:
x = x + 1
camera.start_preview()
camera.start_recording('/home/pi/' ... | en | 0.435568 | #camera.resolution(1920,1080) | 2.160695 | 2 |
Part_3_advanced/m04_datetime_and_timedelta/datetime_formats/example_1.py | Mikma03/InfoShareacademy_Python_Courses | 0 | 6480 | <reponame>Mikma03/InfoShareacademy_Python_Courses<filename>Part_3_advanced/m04_datetime_and_timedelta/datetime_formats/example_1.py<gh_stars>0
from datetime import datetime
def run_example():
moment_in_time = datetime.fromordinal(256)
print(moment_in_time)
print(moment_in_time.toordinal())
print(momen... | from datetime import datetime
def run_example():
moment_in_time = datetime.fromordinal(256)
print(moment_in_time)
print(moment_in_time.toordinal())
print(moment_in_time.weekday())
print(moment_in_time.isoweekday())
other_moment = datetime.fromtimestamp(16_000_000)
print(other_moment)
... | none | 1 | 2.957921 | 3 | |
examples/scripts/segmentation/nnet3-segmenter.py | mxmpl/pykaldi | 916 | 6481 | #!/usr/bin/env python
from __future__ import print_function
from kaldi.segmentation import NnetSAD, SegmentationProcessor
from kaldi.nnet3 import NnetSimpleComputationOptions
from kaldi.util.table import SequentialMatrixReader
# Construct SAD
model = NnetSAD.read_model("final.raw")
post = NnetSAD.read_average_poster... | #!/usr/bin/env python
from __future__ import print_function
from kaldi.segmentation import NnetSAD, SegmentationProcessor
from kaldi.nnet3 import NnetSimpleComputationOptions
from kaldi.util.table import SequentialMatrixReader
# Construct SAD
model = NnetSAD.read_model("final.raw")
post = NnetSAD.read_average_poster... | en | 0.61898 | #!/usr/bin/env python # Construct SAD # Define feature pipeline as a Kaldi rspecifier # Segment | 2.195547 | 2 |
src/dataset.py | HeegyuKim/CurseFilter | 0 | 6482 | <reponame>HeegyuKim/CurseFilter
from cProfile import label
from matplotlib.pyplot import text
import pandas as pd
import numpy as np
from tokenizers import Tokenizer
import torch
from torch.utils.data import Dataset, DataLoader
from typing import Dict, Any, Tuple
from datasets import load_dataset
class DataFrameDatas... | from cProfile import label
from matplotlib.pyplot import text
import pandas as pd
import numpy as np
from tokenizers import Tokenizer
import torch
from torch.utils.data import Dataset, DataLoader
from typing import Dict, Any, Tuple
from datasets import load_dataset
class DataFrameDataset(Dataset):
def __init__(se... | none | 1 | 2.545432 | 3 | |
helper_tools/raspi_OMX-Player_Howto_demo.py | stko/Schnipsl | 0 | 6483 | <gh_stars>0
#!/usr/bin/python
# mp4museum.org by <NAME> 2019
import os
import sys
import glob
from subprocess import Popen, PIPE
import RPi.GPIO as GPIO
FNULL = open(os.devnull, "w")
# setup GPIO pin
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(13, GPIO.IN, pull_up_down ... | #!/usr/bin/python
# mp4museum.org by <NAME> 2019
import os
import sys
import glob
from subprocess import Popen, PIPE
import RPi.GPIO as GPIO
FNULL = open(os.devnull, "w")
# setup GPIO pin
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(13, GPIO.IN, pull_up_down = GPIO.PUD_D... | en | 0.783698 | #!/usr/bin/python # mp4museum.org by <NAME> 2019 # setup GPIO pin # functions to be called by event listener # add event listener # please do not remove my logo screen # the loop | 2.640015 | 3 |
dash_app/compare_alg.py | zeyu2001/ICT1002-Python | 1 | 6484 | """
Comparison between the efficiency of the Boyer-Moore algorithm and the naive substring search algorithm.
The runtimes for both algorithms are plotted on the same axes.
"""
import matplotlib.pyplot as plt
import numpy as np
import string
import time
import random
from bm_alg import boyer_moore_match, naive_match
#... | """
Comparison between the efficiency of the Boyer-Moore algorithm and the naive substring search algorithm.
The runtimes for both algorithms are plotted on the same axes.
"""
import matplotlib.pyplot as plt
import numpy as np
import string
import time
import random
from bm_alg import boyer_moore_match, naive_match
#... | en | 0.816104 | Comparison between the efficiency of the Boyer-Moore algorithm and the naive substring search algorithm. The runtimes for both algorithms are plotted on the same axes. # number of test cases for each iteration # test cases generated based on this pattern (vary_n) # test cases generated based on this text (vary_m) Ge... | 3.659853 | 4 |
TSIS_3/3774.py | GMKanat/PP2_spring | 0 | 6485 | ans = dict()
pairs = dict()
def create_tree(p):
if p in ans:
return ans[p]
else:
try:
res = 0
if p in pairs:
for ch in pairs[p]:
res += create_tree(ch) + 1
ans[p] = res
return res
except:
pass... | ans = dict()
pairs = dict()
def create_tree(p):
if p in ans:
return ans[p]
else:
try:
res = 0
if p in pairs:
for ch in pairs[p]:
res += create_tree(ch) + 1
ans[p] = res
return res
except:
pass... | none | 1 | 3.534165 | 4 | |
italicizer.py | Dorijan-Cirkveni/Miniprojects | 0 | 6486 | def italicize(s):
b = False
res = ''
for e in s:
if e == '"':
if b:
res += '{\\i}' + e
else:
res += e + '{i}'
b=not b
else:
res += e
return res
def main():
F=open('test_in.txt','r')
X=F.read()
F... | def italicize(s):
b = False
res = ''
for e in s:
if e == '"':
if b:
res += '{\\i}' + e
else:
res += e + '{i}'
b=not b
else:
res += e
return res
def main():
F=open('test_in.txt','r')
X=F.read()
F... | none | 1 | 3.853561 | 4 | |
maps/views.py | WPRDC/neighborhood-simulacrum | 0 | 6487 | import json
from typing import Type, TYPE_CHECKING
from django.core.exceptions import ObjectDoesNotExist
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework import viewsets, filters
from rest_framework.exceptions import NotFound
from rest_framew... | import json
from typing import Type, TYPE_CHECKING
from django.core.exceptions import ObjectDoesNotExist
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework import viewsets, filters
from rest_framework.exceptions import NotFound
from rest_framew... | en | 0.703525 | Custom content negotiation scheme for GeoJSON files. `GeoJSONRenderer` is used for downloading geojson files `JSONRenderer` is used for ajax calls. # when the geog is wrong todo: make 400 malformed with info on available geo types | 1.854087 | 2 |
magma/operators.py | Kuree/magma | 0 | 6488 | from magma import _BitType, BitType, BitsType, UIntType, SIntType
class MantleImportError(RuntimeError):
pass
class UndefinedOperatorError(RuntimeError):
pass
def raise_mantle_import_error_unary(self):
raise MantleImportError(
"Operators are not defined until mantle has been imported")
def r... | from magma import _BitType, BitType, BitsType, UIntType, SIntType
class MantleImportError(RuntimeError):
pass
class UndefinedOperatorError(RuntimeError):
pass
def raise_mantle_import_error_unary(self):
raise MantleImportError(
"Operators are not defined until mantle has been imported")
def r... | en | 0.915595 | # __le__ skipped because it's used for assignment on inputs # "__le__", # __le__ skipped because it's used for assignment on inputs # "__le__", # __le__ skipped because it's used for assignment on inputs # "__le__", | 2.533661 | 3 |
src/sultan/result.py | bquantump/sultan | 0 | 6489 | <gh_stars>0
import subprocess
import sys
import time
import traceback
from queue import Queue
from sultan.core import Base
from sultan.echo import Echo
from threading import Thread
class Result(Base):
"""
Class that encompasses the result of a POpen command.
"""
def __init__(self, process, commands,... | import subprocess
import sys
import time
import traceback
from queue import Queue
from sultan.core import Base
from sultan.echo import Echo
from threading import Thread
class Result(Base):
"""
Class that encompasses the result of a POpen command.
"""
def __init__(self, process, commands, context, st... | en | 0.77316 | Class that encompasses the result of a POpen command. # self.dump_exception() # traceback # standard out # standard error # print debug information Converts stdout string to a list. Converts stderr string to a list. Sends input to stdin. Converts traceback string to a list. Returns if the result of the command was a s... | 2.69671 | 3 |
great_expectations/cli/datasource.py | orenovadia/great_expectations | 0 | 6490 | <filename>great_expectations/cli/datasource.py<gh_stars>0
import os
import click
from .util import cli_message
from great_expectations.render import DefaultJinjaPageView
from great_expectations.version import __version__ as __version__
def add_datasource(context):
cli_message(
"""
========== Datasources ... | <filename>great_expectations/cli/datasource.py<gh_stars>0
import os
import click
from .util import cli_message
from great_expectations.render import DefaultJinjaPageView
from great_expectations.version import __version__ as __version__
def add_datasource(context):
cli_message(
"""
========== Datasources ... | en | 0.719602 | ========== Datasources ========== See <blue>https://docs.greatexpectations.io/en/latest/core_concepts/datasource.html?utm_source=cli&utm_medium=init&utm_campaign={0:s}</blue> for more information about datasources. # pandas # default='/data/', # sqlalchemy # Spark # if data_source_selection == "5": # dbt # dbt_pro... | 2.376373 | 2 |
python/crawler/downloader.py | rgb-24bit/code-library | 0 | 6491 | # -*- coding: utf-8 -*-
"""
Provide download function by request
"""
from datetime import datetime
import logging
import time
import urllib.parse
import requests
from bs4 import BeautifulSoup
class Throttle(object):
"""Throttle downloading by sleeping between requests to same domain."""
de... | # -*- coding: utf-8 -*-
"""
Provide download function by request
"""
from datetime import datetime
import logging
import time
import urllib.parse
import requests
from bs4 import BeautifulSoup
class Throttle(object):
"""Throttle downloading by sleeping between requests to same domain."""
de... | en | 0.844006 | # -*- coding: utf-8 -*- Provide download function by request Throttle downloading by sleeping between requests to same domain. # amount of delay between downloads for each domain # timestamp of when a domain was last accessed Convenient download of web pages or caller to call api.
Args:
delay: Interval ... | 3.32259 | 3 |
medium/151.py | pisskidney/leetcode | 0 | 6492 | #!/usr/bin/python
class Solution(object):
def reverseWords(self, s):
if s == '':
return s
res = []
i = len(s) - 2
while i >= -1:
if s[i] == ' ' or i == -1:
word = ''
j = i + 1
while j < len(s) and s[j] != ' ':
... | #!/usr/bin/python
class Solution(object):
def reverseWords(self, s):
if s == '':
return s
res = []
i = len(s) - 2
while i >= -1:
if s[i] == ' ' or i == -1:
word = ''
j = i + 1
while j < len(s) and s[j] != ' ':
... | ru | 0.258958 | #!/usr/bin/python | 3.657467 | 4 |
src/keycloak/connection.py | ecederstrand/python-keycloak | 0 | 6493 | # -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# 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 t... | # -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# 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 t... | en | 0.648842 | # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (C) 2017 <NAME> <<EMAIL>> # # 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 t... | 2.078345 | 2 |
2020/23.py | Valokoodari/advent-of-code | 2 | 6494 | <gh_stars>1-10
#!venv/bin/python3
cs = [int(c) for c in open("inputs/23.in", "r").readline().strip()]
def f(cs, ts):
p,cc = {n: cs[(i+1)%len(cs)] for i,n in enumerate(cs)},cs[-1]
for _ in range(ts):
cc,dc = p[cc],p[cc]-1 if p[cc]-1 > 0 else max(p.keys())
hc,p[cc] = [p[cc], p[p[cc]], p[p[p[cc]]... | #!venv/bin/python3
cs = [int(c) for c in open("inputs/23.in", "r").readline().strip()]
def f(cs, ts):
p,cc = {n: cs[(i+1)%len(cs)] for i,n in enumerate(cs)},cs[-1]
for _ in range(ts):
cc,dc = p[cc],p[cc]-1 if p[cc]-1 > 0 else max(p.keys())
hc,p[cc] = [p[cc], p[p[cc]], p[p[p[cc]]]],p[p[p[p[cc]]... | pt | 0.197967 | #!venv/bin/python3 | 2.429988 | 2 |
run.py | jakewright/home-automation-device-registry | 15 | 6495 | <gh_stars>10-100
# Import the application
from device_registry import app
# Run the application in debug mode
app.run(host='0.0.0.0', port=int(app.config['PORT']), debug=True)
| # Import the application
from device_registry import app
# Run the application in debug mode
app.run(host='0.0.0.0', port=int(app.config['PORT']), debug=True) | en | 0.765595 | # Import the application # Run the application in debug mode | 1.790216 | 2 |
dvc/utils/stage.py | Abrosimov-a-a/dvc | 0 | 6496 | import yaml
from ruamel.yaml import YAML
from ruamel.yaml.error import YAMLError
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader
from dvc.exceptions import StageFileCorruptedError
from dvc.utils.compat import open
def load_stage_file(path):
with open(path,... | import yaml
from ruamel.yaml import YAML
from ruamel.yaml.error import YAMLError
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader
from dvc.exceptions import StageFileCorruptedError
from dvc.utils.compat import open
def load_stage_file(path):
with open(path,... | en | 0.836645 | Parses text into Python structure. Unlike `parse_stage()` this returns ordered dicts, values have special attributes to store comments and line breaks. This allows us to preserve all of those upon dump. This one is, however, several times slower than simple `parse_stage()`. | 2.602393 | 3 |
CAMPODETIRO/test.py | Arguel/old-projects | 0 | 6497 | entrada = input("palabra")
listaDeLetras = []
for i in entrada:
listaDeLetras.append(i)
| entrada = input("palabra")
listaDeLetras = []
for i in entrada:
listaDeLetras.append(i)
| none | 1 | 3.669881 | 4 | |
demos/nn_classification_demo.py | fire-breathing-rubber-lemons/cs207-FinalProject | 0 | 6498 | import numpy as np
from pyad.nn import NeuralNet
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
np.random.seed(0)
data = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(
data.data, data.target, train_size=0.8, random_state=0
)
nn = Ne... | import numpy as np
from pyad.nn import NeuralNet
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
np.random.seed(0)
data = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(
data.data, data.target, train_size=0.8, random_state=0
)
nn = Ne... | none | 1 | 3.10435 | 3 | |
mgatemp.py | zobclub/chapter8 | 1 | 6499 | from microbit import *
I2CADR = 0x0E
DIE_TEMP = 0x0F
while True:
i2c.write(I2CADR, bytearray([DIE_TEMP]))
d = i2c.read(I2CADR, 1)
x = d[0]
if x >=128:
x -= 256
x += 10
print(x)
sleep(500) | from microbit import *
I2CADR = 0x0E
DIE_TEMP = 0x0F
while True:
i2c.write(I2CADR, bytearray([DIE_TEMP]))
d = i2c.read(I2CADR, 1)
x = d[0]
if x >=128:
x -= 256
x += 10
print(x)
sleep(500) | none | 1 | 2.774486 | 3 |