id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
172192 | """
Tema: Funciones decoradoras.
Curso: Curso de python, video 74.
Plataforma: Youtube.
Profesor: <NAME> - Pildoras informaticas.
Alumno: @edinsonrequena.
"""
def funcion_decoradora(funcion_como_parametro):
def funcion_interior(*args, **kwargs):
print('Codigo que se ejecutara antes de llamar a la funci... | StarcoderdataPython |
8120849 | ## @file
# Automate the process of building the various reset vector types
#
# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
import os
import subprocess
import sys
PAGE_TABLE_2M = 'PageTable2M'
PAGE_TABLE_1G = 'PageTable1G'
... | StarcoderdataPython |
11358694 | """
Rename TOPS-20 filespecs to regular files without version number
"""
from os import listdir, rename
import os.path
import re
SOURCEPATH = "10_7_mon/ctls"
tops20File = re.compile("(.*\.\w\w\w)(\.\d)")
files = listdir(SOURCEPATH)
pairs = []
for f in files:
m = tops20File.match(f)
if m:
p = ( ... | StarcoderdataPython |
5102828 | <filename>entrega5.py
# Variables con planteamiento del problema
edad = 18
inc_satisfaccion_por_helado = (edad/100)
satisfaccion_inicial = edad/100
dinero_inicial = 2000
precio_helado_inicial = 100
inc_precio_helado = 20/100
satisfaccion_minima = 85/100
satisfaccion_maxima = 100/100
# Comer helados hasta llegar a la s... | StarcoderdataPython |
249050 | <reponame>cheshire3/cheshire3
from __future__ import absolute_import
import os
import re
from subprocess import Popen, PIPE
from cheshire3.baseObjects import DocumentFactory
from cheshire3.document import StringDocument
from cheshire3.utils import getFirstData, elementType, getShellResult
from cheshire3.exceptions i... | StarcoderdataPython |
4887048 | from pdip.cqrs.decorators import requestclass
@requestclass
class CreateDataIntegrationConnectionQueueRequest:
TopicName: str = None
| StarcoderdataPython |
1700850 | from django.conf.urls import url
from django.conf.urls import patterns
from rest_framework.urlpatterns import format_suffix_patterns
from observations.api.views import MeasurementList
urlpatterns = patterns(
'',
url(r'^measurements/$', MeasurementList.as_view(),
name="observations_api_measurements")... | StarcoderdataPython |
3573352 | ##############################################################################
#
# Copyright (c) 2012 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | StarcoderdataPython |
6515315 | """
Unit tests for output structures
"""
import pytest
import copy
import pickle
from py21cmfast import InitialConditions # An example of an output struct
from py21cmfast import IonizedBox, PerturbedField, TsBox, global_params
@pytest.fixture(scope="function")
def init(default_user_params):
return InitialCond... | StarcoderdataPython |
6468811 | import numpy as np
import json
class NCA():
def __init__(self, var_dims, learning_rate = 0.01, max_steps = 100, init_style = "normal", init_stddev = 0.1):
self.var_dims = var_dims
self.learning_rate = learning_rate
self.max_steps = max_steps
self.init_style = init_style
self... | StarcoderdataPython |
1952472 | import matplotlib
import numpy as np #for array operations
from sklearn import model_selection # spliting the data (80,20)
import pandas #used toread csv file
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
'''---------------... | StarcoderdataPython |
11389363 | from __future__ import absolute_import, division, print_function, unicode_literals
import json
import unittest
from amaascore.market_data.eod_price import EODPrice
from amaascore.tools.generate_market_data import generate_eod_price
class EODPriceTest(unittest.TestCase):
def setUp(self):
self.longMessag... | StarcoderdataPython |
9799568 | global Device
from src.utils import *
from src.utils.read_data import SentenceDataset
from collections import defaultdict
from src.sbert_lsh_model import SBERTLSHModel, BertLSHModel
import os
OPTS = Config.from_command_line(
arg_defaults=[
##### I/O ####
("input", str, "", "input data file: source ... | StarcoderdataPython |
1617017 | import traceback
from boofuzz import constants, exception
from .base_monitor import BaseMonitor
class CallbackMonitor(BaseMonitor):
"""
New-Style Callback monitor that is used in Session to provide callback-arrays.
It's purpose is to keep the \\*_callbacks arguments in the session class while
simplif... | StarcoderdataPython |
11307102 | # MIT License
#
# Copyright (c) 2020 OdinLabs IO
#
# 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, modify, m... | StarcoderdataPython |
228823 | <filename>project_proteus/env/simple/simple_config.py
from project_proteus.env.base import BaseConfig
class SimpleConfig(BaseConfig):
class database:
#path to the database
path = ""
#which candlestick interval should be used in the environment
candlestick_interval = ""
cl... | StarcoderdataPython |
1888641 | words = input().split(", ")
result = [f"{word} -> {len(word)}" for word in words]
print(", ".join(result))
| StarcoderdataPython |
11385387 | import pygame
'''The following code shows how to add transparency to an
image and shows which images can be made transparent.
This example was created using this tutorial
https://www.pygame.org/docs/tut/ChimpLineByLine.html
Line By Line Chimp
Author: <NAME>
https://www.pygame.org/docs/ref/surface.html
Colorkey trans... | StarcoderdataPython |
8146669 | <reponame>mehrab97/Leetcoding
class Solution:
def findNumbers(self, nums: List[int]) -> int:
if len(nums) == 0:
return 0
return sum([1 for x in nums if len(str(x))%2 ==0]) | StarcoderdataPython |
6557605 | """Beam models and chromaticity corrections."""
from __future__ import annotations
from pathlib import Path
import logging
import hashlib
from methodtools import lru_cache
import astropy.coordinates as apc
import astropy.time as apt
import h5py
import numpy as np
import scipy.interpolate as spi
from tqdm import tqdm
i... | StarcoderdataPython |
3275075 | <filename>MetaQA/QA_Dataset/QA_Dataset.py
from __future__ import annotations
import json
import random
from datasets import load_dataset, load_metric
import json
import re
import string
from collections import Counter
from rouge_score import rouge_scorer
import pandas as pd
import os
class QA_Dataset():
def __init... | StarcoderdataPython |
1723668 | <reponame>satvidh/batch-scoring
import pytest
from datarobot_batch_scoring.api_response_handlers import pred_api_v10, api_v1
from datarobot_batch_scoring.consts import Batch
from datarobot_batch_scoring.exceptions import UnexpectedKeptColumnCount, \
NoPredictionThresholdInResult
@pytest.fixture()
def parsed_pred_... | StarcoderdataPython |
213759 | from time import sleep
from SillyStateMachine import SillyStateMachine
def check_list(correct_list, actual_list):
for x in range(0, len(correct_list) - 1):
assert correct_list[x] == actual_list[x]
class BasicStateMachine(SillyStateMachine):
"""Test child"""
def init_setup(self):
self.statu... | StarcoderdataPython |
6500016 | <reponame>sppautomation/sppclient
# Script to check the status of vSnap provider(s) in SPP
# Use registervsnap.py -h for help
import json
import logging
from optparse import OptionParser
import sys
import spplib.sdk.client as client
logging.basicConfig()
logger = logging.getLogger('logger')
logger.setLevel(logging.INF... | StarcoderdataPython |
3561839 | <reponame>longwangjhu/LeetCode<gh_stars>1-10
# https://leetcode.com/problems/subtree-of-another-tree/
# Given the roots of two binary trees root and subRoot, return true if there is a
# subtree of root with the same structure and node values of subRoot and false
# otherwise.
# A subtree of a binary tree tree is a tre... | StarcoderdataPython |
157905 | <reponame>cvahid/threatconnect-playbooks
# -*- coding: utf-8 -*-
"""ThreatConnect Playbook App"""
# Import default Playbook Class (Required)
from playbook_app import PlaybookApp
class App(PlaybookApp):
"""Playbook App"""
def run(self):
"""Run the App main logic.
This method should contain t... | StarcoderdataPython |
352682 | <gh_stars>10-100
""""""
"""
==============
Binary Search
==============
TIme Complexity
Worst Case : O( log(n) )
Average Case : O( log(n) )
Best Case : O(1)
Space Complexity : O(1)
Binary Search is a sorting algorithm in which we select the mid element and compare key to the mid element if key is
smaller ... | StarcoderdataPython |
1625203 | from asynctest import TestCase as AsyncTestCase, mock as async_mock
from aries_cloudagent.indy.sdk.profile import IndySdkProfile
from ....askar.profile import AskarProfileManager
from ....config.injection_context import InjectionContext
from ....core.in_memory import InMemoryProfile
from ....indy.sdk.wallet_setup imp... | StarcoderdataPython |
290135 | #!/usr/bin/env python3
########################################################################################################################
##### INFORMATION ######################################################################################################
### @PROJECT_NAME: SPLAT: Speech Processing and Lingu... | StarcoderdataPython |
1609790 | # -*- coding:utf-8 -*-
"""
@author: leonardo
@created time: 2020-11-03
@last modified time:2020-11-03
"""
from sqlalchemy import create_engine,event
import numpy as np
def get_connection(database_name):
"""
:param database_name:
:return:
"""
return create_engine('mysql+pymysql://root:yangxh@192.16... | StarcoderdataPython |
3331804 | <filename>__main__.py
#!/usr/bin/env python
# import sys
import footmark
#from footmark.ecs.connection import ECSConnection
def main():
print "Hello World!"
if __name__== "__main__":
main()
print "This is main Program"
#app=ECSConnection()
#app.run()
| StarcoderdataPython |
6586771 | # This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""
Capture PNG or JPEG images of the channel viewer image.
**Usage**
1. Select the RGB graphics type for the snap from the "Type" combo box.
2. Press "Snap" when you have the channel image the way you want to ... | StarcoderdataPython |
8085251 | import random
def chunk(list, n):
"""Breaks a list into chunks of size n."""
return [list[i:i + n] for i in range(0, len(list), n)]
def balance_groups(groups):
"""Balances a list of lists, so they are roughly equally sized."""
numPlayers = sum([len(group) for group in groups])
minGroupSize = int... | StarcoderdataPython |
8069498 | <reponame>mlbullett/mybigfatrussianwedding<filename>contactus/models.py
""" contactus/models.py """
from django.db import models
from django.utils.timezone import now
class Contact(models.Model):
""" model for contacts """
name = models.CharField(max_length=200)
from_email = models.EmailField(max_length=1... | StarcoderdataPython |
5197572 | <reponame>kosciak/ecs-rogal
import collections
import enum
import string
ASCII_CHARS = set()
for chars in [
string.digits,
string.ascii_lowercase,
string.ascii_uppercase,
string.punctuation,
]:
ASCII_CHARS.update(*chars)
class Modifier(enum.IntFlag):
NONE = 0
SHIFT = 1
CTRL = 2
A... | StarcoderdataPython |
11330868 | <gh_stars>0
import json
import os
from abc import abstractmethod
from datetime import datetime
import keras
import keras.backend as K
from keras.callbacks import ModelCheckpoint, TensorBoard
from keras.layers import Input, Lambda
from keras.models import Model
from keras.optimizers import Adam
from callbacks.common i... | StarcoderdataPython |
3206714 | from dolfin import *
import numpy as np
import matplotlib.pyplot as plt
import tqdm
from scipy.sparse import lil_matrix, coo_matrix
mesh = UnitSquareMesh(20,20, "crossed")
V = FunctionSpace(mesh, "P", 1)
def density_alogrithm(V, u, R=0.2):
r = V.tabulate_dof_coordinates()
A = lil_matrix((len(r), len(r)))
... | StarcoderdataPython |
3360605 | from pathlib import Path
from setuptools import find_packages, setup
PACKAGE_ROOT = Path(__file__).parent
VERSION = PACKAGE_ROOT / "version.txt"
def read_requirements(name: str):
p = PACKAGE_ROOT.joinpath(name)
reqs = []
for line in p.read_text().splitlines():
if not line or line.startswith("#")... | StarcoderdataPython |
1737328 | import asyncio
import discord
import json
import os
import logging
import DBSkr
import hcskr
from discord.ext import commands
from pymongo import MongoClient
my_client = MongoClient("mongodb://localhost:27017/")
mydb = my_client['jindan']
mycol = mydb['userinfo']
loop = asyncio.get_event_loop()
def get_bot_setting... | StarcoderdataPython |
3501107 | <filename>dropper.py
#!/usr/bin/python
# Stego Dropper For Pentesters v0.1
# Heavily uses parts from https://github.com/RobinDavid/LSB-Steganography
import urllib
import urllib2
import httplib
import subprocess
import sys
import os
import string
import cv2.cv as cv
import logging
from optparse import OptionParser
# T... | StarcoderdataPython |
6587336 | <filename>Project1/mapGenerator.py
import pygame
import time
import random
import os
from datetime import datetime
from os import listdir
from pygame.locals import *
from button import *
from WFC import *
class MapGenerator:
def __init__(self, game):
self.game = game
self.screen = game.screen
... | StarcoderdataPython |
11296607 | import numpy as np
import cv2 as cv
import base64
import time
import zmq
import IO
TIMEOUT = 1000
def initialize_socket(port="555"):
global socket
print("[ZMQ SERVER] Socket initializing...", end="")
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.setsockopt(zmq.RCVTI... | StarcoderdataPython |
11383208 | from dataclasses import dataclass
from typing import List, Optional, Any
@dataclass
class LoginFormData:
CID: int
SID: int
PID: int
CN: int
SFT: int
SCID: int
@dataclass
class Mark:
assignmentId: int
studentId: int
mark: Optional[int]
dutyMark: bool
@dataclass
class Subject... | StarcoderdataPython |
1612115 | import os
from django.conf import settings
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'src.settings')
django_asgi_app = get_asgi_application()
"""Imports only after get_asgi_application() and env.
Excluded error like:
django.core.exceptions.AppRegistryNotReady: ... | StarcoderdataPython |
1898966 | #! /usr/bin/python3
"""
InstabotAI - Instagram Bot With Face Detection
Intro:
This bot autoscrape users from variable output -l
if a face is detected it will repost, repost to
stories, send DM to users, like and comment that
photo. If no face is detected in image it will
scrape the next prof... | StarcoderdataPython |
9793843 | <filename>cifar10/models/__init__.py
from .wideresnet import *
from .resnet import *
from .dpn import *
from .se_resnet import *
from .se_resnext import *
from .pre_resnet import *
from .resnext import *
from .resnext_101_32x4d import *
from .resnext_50_32x4d import *
from .resnext_101_64x4d import *
from .wrn_50_2f im... | StarcoderdataPython |
215226 | <gh_stars>10-100
import pandas as pd
from pyam import IamDataFrame
def get_netzero_data(df, meta, default_year):
"""Reformat an IamDataFrame selecting the year via a meta column"""
lst = []
# iterate over scenarios and retrieve timeseries data for the year given by `meta`
for model, scenario in df.i... | StarcoderdataPython |
4932395 | <reponame>private-yusuke/Competitive-Programming
A, B, C = map(int, input().split())
if A==B: print(C)
elif B==C: print(A)
else: print(B) | StarcoderdataPython |
4966548 | import itertools
from microbenchmarks._metric import MetricType
from microbenchmarks._utils import get_ti_arch, tags2name
import taichi as ti
class Funcs():
def __init__(self):
self._funcs = {}
def add_func(self, tag_list: list, func):
self._funcs[tags2name(tag_list)] = {'tags': tag_list, '... | StarcoderdataPython |
4997182 | from monitor.watcher import Watcher
import time
try:
import configparser
except ImportError:
import ConfigParser as configparser
def multi_watch(args):
gens = []
config = configparser.ConfigParser()
config.read('conf/monitor.conf')
for name in config.sections():
print('-----[%s]-----' ... | StarcoderdataPython |
5170123 | <filename>api/staff/migrations/0007_auto_20211219_2259.py
# Generated by Django 3.2.10 on 2021-12-19 22:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('staff', '0006_auto_20211218_2005'),
]
operations = [
... | StarcoderdataPython |
99594 | from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.view import view_config
import pyramid.httpexceptions as exc
import re
from pyramid.request import Request
from _pybgpstream import BGPStream, BGPRecord, BGPElem
from datetime impor... | StarcoderdataPython |
11310073 | <gh_stars>1-10
"""GitHub organization model."""
from .user import GitHubBaseUserModel
class GitHubOrganizationModel(GitHubBaseUserModel):
"""GitHub organization model."""
| StarcoderdataPython |
166061 | <gh_stars>1-10
from w3lib.http import basic_auth_header
from scrapy.utils.project import get_project_settings
class ProxyMiddleware(object):
def process_request(self, request, spider):
settings = get_project_settings()
request.meta['proxy'] = settings.get('PROXY_HOST') + ':' + settings.get('PROXY_... | StarcoderdataPython |
1792434 | import sys
# sys.stdin = open("in.txt", 'r')
t = int(input())
for i in range(t):
s = list(str(input()))
s.sort(reverse=True)
print("".join(s))
| StarcoderdataPython |
345667 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name="data_flow",
version="0.3",
description="A system transform data consistently and easily",
packages=["dataflow"],
url='https://github.com/LordFeratum/DataFlow',
download_url='https://github.com/LordFeratum/DataFlow/archi... | StarcoderdataPython |
8152565 | __version__ = "0.1"
__author__ = "Julin"
import argparse
from pextn import pextn, UnknownExtension
parser = argparse.ArgumentParser(
prog="pextn",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="A simple, lazy utility to display information about a file extension"
)
parser.add_argume... | StarcoderdataPython |
5145965 | <filename>Vector.py
import math
import copy
class Vector(list):
""" Vector.py
6/24/2009 by <NAME>
simple list-based vector class
Notes:
- Inspired by http://code.activestate.com/recipes/52272/
- Supports 2D and 3D vectors
- Constructor takes e... | StarcoderdataPython |
4816567 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from dash.dependencies import Input, Output
df0 = pd.read_csv('https://gist.githubusercontent.com/chriddyp/c78bf172206ce24f77d6363a2d754b59/raw/c353e8ef842413cae56ae3920b8fd7846... | StarcoderdataPython |
114230 | <filename>disparity/helpers.py<gh_stars>1-10
import csv
import math
import time
import json
import numpy as np
from beautifultable import BeautifulTable
from pymongo import MongoClient
class Helper:
def __init__(self,
db_name="WorkerSet100K",
collection_name="workers",
... | StarcoderdataPython |
3534124 | <filename>guanabara/Exercicios/utilidades/cor/__init__.py
c = {'z': '\033[m'}
l = ['w', 'r', 'g', 'y', 'b', 'm', 'c', 'k']
i = j = 0
for lin in range(30, 38):
c[l[i]] = f'\033[{lin}m'
i += 1
i = j = 0
for lin in range(30, 38):
for col in range(40, 48):
c[l[i] + l[j]] = f'\033[{lin};{col}m'
... | StarcoderdataPython |
4829225 | """Test template loading functions."""
import pytest
import flatware.template_loading as loading
def test_load_file(tmpdir):
"""Test we can load a plate."""
plate = tmpdir.join("recipe")
plate.write("Plate text")
result = loading.load_template("recipe", template_dir=str(tmpdir))
assert result ==... | StarcoderdataPython |
6450588 | from __future__ import absolute_import
from __future__ import print_function
import os
import sys
from conversion_imagenet import TestModels
def get_test_table():
return { 'darknet' :
{
'yolov2' : [
#TestModels.onnx_emit,
#TestModels.caffe_emit,
... | StarcoderdataPython |
1638831 | # -*- coding: utf-8 -*-
from . import TenantWrappedCommand
from django.contrib.staticfiles.management.commands import collectstatic
class Command(TenantWrappedCommand):
COMMAND = collectstatic.Command
| StarcoderdataPython |
6422023 | # Generated by Django 2.2.1 on 2019-06-29 14:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('smarttm_web', '0030_attendance'),
]
operations = [
migrations.AddField(
model_name='meeting',
name='meeting_no',
... | StarcoderdataPython |
389549 | <reponame>VictorZXY/meowjong<filename>evaluation/hand_calculation/yaku_list/tanyao.py
from typing import List
from evaluation.hand_calculation.tile_constants import YAOCHUUHAI
from evaluation.hand_calculation.yaku import Yaku
class Tanyao(Yaku):
"""
Hand with no terminals and honours.
"""
def __init... | StarcoderdataPython |
9614433 | <gh_stars>0
from django.db import models
#from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
import pathlib
import re
class Collision(models.Model):
experiment_id = models.CharField(ma... | StarcoderdataPython |
1773060 | from django.db import models
class Category(models.Model):
name = models.CharField(max_length=150)
def __str__(self):
return self.name
class Product(models.Model):
name = models.CharField(max_length=150)
nutriscore = models.CharField(max_length=1)
url = models.URLField()
image_url =... | StarcoderdataPython |
8190898 | from revarie import Revarie
from revarie import Variogram
from revarie import fvariogram
import numpy as np
import time
import datetime
from .output import write
from pathlib import Path
def bench_variogram(tlimit = 15, path = "."):
"""
Run timing benchmark test for variogram class. Results are formatted and
... | StarcoderdataPython |
6569544 | <reponame>BrianOtieno/tClinix<gh_stars>0
from bcrypt import gensalt, hashpw
from flask import current_app
from flask_login import UserMixin
from sqlalchemy import Column, Float, Integer, String
from sqlalchemy.orm import relationship
from threading import Thread
from tClinix import db , scheduler
from tClinix.base.cus... | StarcoderdataPython |
395712 | <filename>angrytux/model/game_objects/enemies/enemy_states/HittedState.py
from angrytux.model.game_objects.enemies.enemy_states.DeadState import DeadState
from angrytux.model.game_objects.enemies.enemy_states.EnemyState import EnemyState
class HittedState(EnemyState):
def __init__(self, enemy):
super()._... | StarcoderdataPython |
212899 | <reponame>mbatchkarov/dc_evaluation
import pytest
from numpy.testing import assert_array_equal
from discoutils.thesaurus_loader import Vectors
from discoutils.tokens import DocumentFeature, Token
DIM = 10
unigram_feature = DocumentFeature('1-GRAM', (Token('a', 'N'),))
unk_unigram_feature = DocumentFeature('1-GRAM', (... | StarcoderdataPython |
1635540 | from typing import Optional
import keyring
import os
from ..util import KEYRING_SERVICE, is_plain_secret_storage, fatal, run, session_file
def signin(account: str) -> Optional[str]:
(status, stdout, stderr) = run(["signin", "--raw", f"--account={account}"], silent=True)
if not status:
fatal(stderr)
... | StarcoderdataPython |
8194435 | <reponame>AAm-kun/netmiko
import time
from netmiko.base_connection import BaseConnection
class WatchguardFirewareSSH(BaseConnection):
"""
Implements methods for communicating with Watchguard Firebox firewalls.
"""
def session_preparation(self):
"""
Prepare the session after the connec... | StarcoderdataPython |
1756425 | def isPerfect(n):
s = 1
k = 2
while(k * k <= n):
if n % k == 0:
s += k
m = n // k
if m != k:
s += m
k += 1
return s == n
a = int(input("a: "))
b = int(input("b: "))
for i in range(a,b):
if isPerfect(i):
print(i)
| StarcoderdataPython |
9716103 | <reponame>Sourolio10/face-antispoofing-using-mobileNet<filename>model.py
import tensorflow as tf
from layers import depthwise_separable_conv2d, conv2d, avg_pool_2d, dense, flatten, dropout
import os
from utils import load_obj, save_obj
import numpy as np
class MobileNet:
"""
MobileNet Class
"""
def _... | StarcoderdataPython |
11219911 | <gh_stars>0
import os
from setuptools import Command
from setuptools.command.develop import develop
from setuptools.command.install_lib import install_lib
import subprocess
import sys
from typing import List, Optional
from rustypy.module import RustyModule
class RustCommand(Command):
description = "build rust e... | StarcoderdataPython |
3259314 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from setuptools import setup
packages = ['codesync', 'notificator']
package_data = {'': ['*']}
entry_points = {'console_scripts': ['codesync = codesync.cli:run']}
setup_kwargs = {
'name': 'codesync',
'version': '1.0',
'description': 'Sync your code changes as you m... | StarcoderdataPython |
5043196 | n = int(input("> "))
odpowiedzi = [[] for x in range(n)]
def mozna_stworzyc(literki: list, slowo: str) -> bool:
lst = []
for l in slowo:
if l.upper() in literki:
literki.remove(l.upper())
lst.append(True)
else:
lst.append(False)
return all(lst)
for... | StarcoderdataPython |
3539084 | <reponame>wu-uw/OpenCompetition
import pandas as pd
from sklearn import datasets
from gplearn.genetic import SymbolicTransformer
from sklearn.model_selection import train_test_split
# def data_prepare():
# boston = datasets.load_boston()
# boston_feature = pd.DataFrame(boston.data, columns=boston.feature_name... | StarcoderdataPython |
3213389 | <filename>senpy/neyer.py
# -*- coding: utf-8 -*-
import numpy as np
from scipy.optimize import minimize, brute, fmin
from .confidence import (parametric_bootstrap, nonparametric_bootstrap,
delta, contour_walk, increase_bounds,
HomogeneousResult)
from .plotting import plo... | StarcoderdataPython |
6416959 | <reponame>pongorlorinc/mcaller
import os
import optparse
import pysam
import sys
import numpy
import scipy
from scipy.stats import poisson
from scipy.stats import fisher_exact
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
parser = optparse.OptionParser()
parser.add_option('-g',... | StarcoderdataPython |
9673686 | banido = 'https://tenor.com/view/ednaldo-pereira-banido-desbanido-meme-meme-banido-gif-19429642'
desbanido = 'https://tenor.com/view/desbanido-ednaldo-pereira-ednaldo-pereira-banido-gif-19443137'
repositorio = 'https://github.com/Eduardo-Barreto/Marselo-Bot'
readme = 'https://github.com/Eduardo-Barreto/Marselo-Bot/blob... | StarcoderdataPython |
9622401 | <reponame>carpedkm/vedatad
from vedacore.misc import registry
from .base_hook import BaseHook
@registry.register_module('hook')
class WorkerInitHook(BaseHook):
"""Worker init for training."""
def before_train_epoch(self, looper):
worker_init_fn = looper.train_dataloader.worker_init_fn
if work... | StarcoderdataPython |
6524710 | # coding=utf-8
# Copyright 2018-present Open Networking Foundation
# SPDX-License-Identifier: Apache-2.0
'''
This module contains a switch class for Mininet: StratumTofinoModel
Usage
-----
From withing the Docker container, you can run Mininet using the following:
$ mn --custom tools/mininet/tofino-model.py --switch ... | StarcoderdataPython |
5109565 | #-----------------------------------------------------------------------------
# Copyright (c) 2018 <NAME>, <NAME>, <NAME>
# danielhn<at>ece.ubc.ca
#
# Permission to use, copy, and modify this software and its documentation is
# hereby granted only under the following terms and conditions. Both the
# above copyright no... | StarcoderdataPython |
6553905 | <filename>Examples/Alias Record/delete_alias_record_example/delete_alias_record_example_page.py
# Copyright 2017 BlueCat Networks. All rights reserved.
# Various Flask framework items.
import os
import sys
from flask import url_for, redirect, render_template, flash, g, request
from bluecat import route, util
import ... | StarcoderdataPython |
12802834 | from stix_shifter_utils.utils.error_mapper_base import ErrorMapperBase
from stix_shifter_utils.utils.error_response import ErrorCode
from stix_shifter_utils.utils import logger
error_mapping = {
# These are only examples. Change the keys to reflect the error codes that come back from the data source API.
# sea... | StarcoderdataPython |
4992669 | import click
import os
import ntpath
#Temp, delete this
import sys
import tempfile
from shutil import make_archive, rmtree, unpack_archive, copy
sys.path.insert(0, '.')
from modelchimp.connection_thread import RestConnection
from modelchimp.utils import generate_uid
from modelchimp.log import get_logger
logger = get_... | StarcoderdataPython |
1631992 | <reponame>subramp-prep/leetcode<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <<EMAIL>[at]gmail.com>
# File: AC_hash_two_sum_n2logn.py
# Create Date: 2015-03-04 17:54:25
# Usage: AC_hash_two_sum_n2logn.py
# Descripton:
import collections
import itertools
class Solution:
... | StarcoderdataPython |
6631502 | <gh_stars>1-10
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def preorderTraversal(self, root: TreeNode) -> List[int]:
if not root or not root.val:
return []
... | StarcoderdataPython |
3350812 | <reponame>oboforty/eme<gh_stars>1-10
import os
import sys
from eme.entities import load_handlers, load_settings
from eme.website import WebsiteBlueprint
from .services import auth
module_path = os.path.dirname(os.path.realpath(__file__))
conf = load_settings(os.path.join(module_path, 'config.ini'))
sys.pat... | StarcoderdataPython |
1796767 | <filename>data.py
from multiprocessing.pool import ThreadPool
import pandas as pd
import requests
import xmltodict
from helper import *
class Data:
def __init__(self):
self.df = pd.DataFrame(data={})
# https://volby.cz/pls/ps2017nss/vysledky_okres?nuts=CZ0806
self.downloaded = 0
... | StarcoderdataPython |
4902850 | import numpy as np
import matplotlib as plt
import gym
import IntrinsicRewardModel
from environment import Environment
from utils import HyperParameters, one_hot_encode_action
BENCHMARK_ENVIRONMENT = 'CartPole-v0'
@staticmethod
def batch_train():
# track results
states = []
actions = []
ext_rewards =... | StarcoderdataPython |
3546335 | __title__ = "lavarand"
__description__ = "Randomness 101: LavaRand in Production"
__url__ = "https://csprng.xyz/"
__version__ = "1.1.1.5"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2.0"
__copyright__ = "Copyright (C) 2018-Present <NAME>"
| StarcoderdataPython |
3559956 | '''
Created on 03.07.2020
@author: JR
'''
from libsbml import SBMLDocument, CVTerm, XMLNode, XMLTriple, XMLAttributes,\
XMLNamespaces, SBMLWriter
import libsbml
from libsbml._libsbml import BIOLOGICAL_QUALIFIER, BQB_IS
from libcombine import CombineArchive, OmexDescription, KnownFormats, VCard
import pan... | StarcoderdataPython |
9715416 | from typing import Union
class NoTokenException(Exception):
def __init__(self, value: Union[str, int]) -> None:
super().__init__()
self.value = value
def __str__(self) -> str:
return str(self.value)
| StarcoderdataPython |
5168581 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SPDX-Short-Identifier: MIT
# (c) 2019 <NAME>
# This code is licensed under MIT license (See LICENSE.txt for details)
__author__ = "<NAME>"
__copyright__ = "Copyright 2019, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME... | StarcoderdataPython |
9734530 | """Tools to visualize data and display results"""
import os
import shutil
import StringIO
import cgi
import uuid
import abc
from datetime import datetime
from collections import Counter
import itertools as it
import numpy as np
from diogenes import utils
import matplotlib
if utils.on_headless_server():
matplotli... | StarcoderdataPython |
6559614 | <gh_stars>1-10
from django.urls import path
from . import views
urlpatterns = [
path("detail", views.PartnerDetailView.as_view(), name="partner-detail"),
path("agreement", views.PartnerAgreementView.as_view(), name="partner-agreement"),
]
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.