id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3307351
<filename>KNet/lib/switches.py '''Copyright 2018 KNet Solutions, India, http://knetsolutions.in 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/LICENS...
StarcoderdataPython
4817279
#!/usr/bin/env python # encoding: utf-8 """Simple MD5 generation. """ __version__ = "$Id$" import hashlib from hashlib_data import lorem h = hashlib.md5() h.update(lorem) print h.hexdigest()
StarcoderdataPython
3229013
import torch.nn.functional as F from segmentron.models.model_zoo import MODEL_REGISTRY from segmentron.models.segbase import SegBaseModel from segmentron.config import cfg from segmentron.modules.dmlp import DMLP __all__ = ['Trans4PASS'] @MODEL_REGISTRY.register(name='Trans4PASS') class Trans4PASS(SegBaseModel): ...
StarcoderdataPython
1762734
from django.db import models class Book(models.Model): isbn = models.TextField(unique=True) title = models.TextField() author = models.TextField() description = models.TextField() def __str__(self): return f'{self.title}'
StarcoderdataPython
1675954
<reponame>bluekyu/RenderPipeline """ RenderPipeline Copyright (c) 2014-2016 tobspr <<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 the...
StarcoderdataPython
3323313
<filename>01_von_Karman_square/src/cmpt_stats.py """ ******************************************************************************** computes statistics ******************************************************************************** """ import numpy as np def fwd_stats(u, u_, n): mse = np.mean(np.square(u - u_)...
StarcoderdataPython
3211933
# -*- coding:utf-8 -*- import os import random import cv2 import argparse def mkdir_if_not_exist(path): if not os.path.exists(os.path.join(*path)): os.makedirs(os.path.join(*path)) class CasiaSurf(object): def __init__(self): self.color_list = [] self.depth_list = [] self.ir_...
StarcoderdataPython
1634693
<gh_stars>0 ''' Created on May 19, 2013 Re-implementation of dumpevent.cc @author: <NAME>, CERN ''' import sys def dumpevent( fileName, eventNumber, runNumber=None ): from pyLCIO import IOIMPL reader = IOIMPL.LCFactory.getInstance().createLCReader() reader.open( fileName ) event = None if ru...
StarcoderdataPython
1720116
<gh_stars>1-10 # ~*~ encoding: utf-8 ~*~ from pymongo import MongoClient from pandas import read_csv from datetime import date mongodb = MongoClient('192.168.178.82', 9999) db = mongodb['dev'] drug_collection = db['drug'] drugs = read_csv('~/Dokumente/bfarm_lieferenpass_meldung.csv', delimiter=';', encoding='iso8859...
StarcoderdataPython
3331808
# AUTO GENERATED FILE - DO NOT EDIT from dash.development.base_component import Component, _explicitize_args class ForceArrayPlot(Component): """A ForceArrayPlot component. The ForceArrayPlot component is used to visualize the shapley contributions to multiple predictions made by a tree-based ML model. This is a...
StarcoderdataPython
111614
from __future__ import absolute_import # from similarities import all_similarities from .scoss import Scoss from .smoss import SMoss from .main import *
StarcoderdataPython
95544
<reponame>frozenbey/noxususerbot import threading from sqlalchemy import func, distinct, Column, String, UnicodeText try: from userbot.modules.sql_helper import SESSION, BASE except ImportError: raise AttributeError class Mesajlar(BASE): __tablename__ = "mesaj" komut = Column(UnicodeText, primary_key=...
StarcoderdataPython
3351834
<gh_stars>1-10 from clientbase.clientsocket import TcpCliSock from clientbase.crypto import * import time class ClientBase: def __init__(self): self.clisock = TcpCliSock() self.key = None self.name = None self.logged = False self.allm = 6277101735386680763835789423207666416102355444464034512659 self.alliv ...
StarcoderdataPython
86772
<filename>products/models.py from django.conf import settings from django.db import models # Create your models here. class Product(models.Model): """Model definition for Product.""" # TODO: Define fields here name = models.CharField(max_length=60) description = models.CharField(max_length=140, blan...
StarcoderdataPython
176980
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from builtins import * import numpy as np from .rnn_base import RNNBase from .utils import SymbolTable class TextRNN(RNNBase): """TextRNN for strings of text.""" ...
StarcoderdataPython
3299732
def movie(card, ticket, perc):
StarcoderdataPython
1777607
from dcos_installer import config from gen.exceptions import ValidationError def test_normalize_config_validation_exception(): errors = { 'key': {'message': 'test'}, } validation_error = ValidationError(errors=errors, unset=set(['one', 'two'])) normalized = config.normalize_config_validation_e...
StarcoderdataPython
3389956
<reponame>asvatov/pomodoro-timer import webbrowser import gi from pomodoro_timer.components.about_dialog import on_about_item from pomodoro_timer.configs.main_configs import WEBSITE_BUG_REPORTS from pomodoro_timer.configs.strings_config import STRING_ABOUT, STRING_BUGS gi.require_version("Gtk", "3.0") from gi.repos...
StarcoderdataPython
3249924
import asyncio import gzip import socket import threading from collections import defaultdict from contextlib import contextmanager from queue import Queue from google.protobuf import json_format from sanic import Sanic, response from signalfx.generated_protocol_buffers import signal_fx_protocol_buffers_pb2 as sf_pbuf...
StarcoderdataPython
55412
import BotDecidesPos import numpy as np class Collision_check: def __init__(self): self.m=0.0 self.n=0.0 def load_data(self,bot): tgx,tgy=bot.getTarget() mpx,mpy=bot.getPos() spd=bot.getSpeed() return spd,mpx,mpy,tgx,tgy def checkCollisio...
StarcoderdataPython
44613
<gh_stars>0 from typing import List, NoReturn from lib.t import T class Lecture: # Vorlesungen/Fächer subject: str room: str schedule: List[T] def __init__(self, subject: str, room: str, *schedule: T ) -> NoReturn: self.subje...
StarcoderdataPython
3293251
<reponame>srinirama/datacamp-downloader import sys import threading import time import colorama from config import Config as con from helper import bcolors from utils import download_course, download_track, get_completed_tracks, get_completed_courses, get_all_courses def main(argv): if argv[0] == 'settoken': ...
StarcoderdataPython
3270984
from django.conf import settings from django.core.exceptions import ValidationError __all__ = ['validate_url_keyword'] _default_keywords = ('new', 'edit', 'delete') _keywords = getattr(settings, 'URL_KEYWORDS', _default_keywords) def validate_url_keyword(value): """ Validates that `value` is not one of ...
StarcoderdataPython
3202719
# -*- coding: utf-8 -*- from odoo import models, fields, api,tools,_ from datetime import datetime, timedelta from odoo.exceptions import UserError # Cap Nhat Trang Thai chuyen dich kho (daft) class Update_Invoice_Out(models.Model): _inherit = "stock.picking" # cap nhat trang thai hoa don # class Update_Invoice...
StarcoderdataPython
3347836
from .LCV_ours_sub3 import LCV as LCV_ours_sub3
StarcoderdataPython
1722402
<reponame>yskn67/redashbot-python<gh_stars>1-10 #! /usr/bin/env python3 # -*- coding: utf-8 -*- import os API_TOKEN = os.environ['SLACK_BOT_TOKEN'] DEFAULT_REPLY = 'Usage: @redashbot {}/queries/<query-number>#<visualization-number>'.format(os.environ['REDASH_HOST']) PLUGINS = [ 'plugins' ]
StarcoderdataPython
181383
<filename>src/AWS.py import schedule from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.action_chains import ActionChains from selenium...
StarcoderdataPython
3393421
#!/home/kjell/envs/vol-env/bin/python import discord from discord.ext import commands import traceback import sys import logging import asyncio import asyncpg import auth_token import aiohttp # set up logging logger = logging.getLogger('discord') logger.setLevel(logging.INFO) handler = logging.FileHandler( file...
StarcoderdataPython
3270204
class Bunker: def __init__(self): self.survivors = [] self.supplies = [] self.medicine = [] @property def food(self): food_supplies = [f for f in self.supplies if f.__name__ == "FoodSupply"] if not food_supplies: raise IndexError("There are no food suppl...
StarcoderdataPython
26191
# -*- coding: utf-8 -*- i = 1 for x in range(60, -1, -5): print('I={} J={}'.format(i, x)) i += 3
StarcoderdataPython
136697
# RAiDAuth and RAiDFactory classes # # Wrapper classes around the Python Requests library # to facilitate the creation and updating of RAiDs # # Written by <NAME> <<EMAIL>> # # Updated 23 Jul 2020 import logging import requests from requests.auth import AuthBase from urllib.parse import quote import backoff from .mt_j...
StarcoderdataPython
3386113
<gh_stars>100-1000 import unittest from vint.linting.config.config_comment_parser import ( parse_config_comment, ConfigComment, ) class ConfigCommentAssertion(unittest.TestCase): def assertConfigCommentEqual(self, a, b): # type: (ConfigComment, ConfigComment) -> None self.assertEqual(a.co...
StarcoderdataPython
14047
def formstash_to_querystring(formStash): err = [] for (k, v) in formStash.errors.items(): err.append(("%s--%s" % (k, v)).replace("\n", "+").replace(" ", "+")) err = sorted(err) err = "---".join(err) return err class _UrlSafeException(Exception): @property def as_querystring(self): ...
StarcoderdataPython
3213588
<gh_stars>0 from __future__ import annotations from dataclasses import dataclass from typing import Union, List from item_engine import Item, Group, Match import python_generator as pg __all__ = ["TokenI", "TokenG"] class TokenG(Group): @property def items_str(self) -> str: return '\n'.join(map(repr...
StarcoderdataPython
1794883
<filename>od_client/enums.py from enum import Enum class OdEndpoint(Enum): entries = "entries" inflections = "inflections" translations = "translations" class LexiStatsSort(Enum): word_form_asc = "wordform" true_case_asc = "trueCase" lemma_asc = "lemma" lexical_category_asc = "lexicalCat...
StarcoderdataPython
3275160
<reponame>gautierdag/cultural-evolution-engine<filename>data/__init__.py from .AgentVocab import AgentVocab from .feature_extractor import get_features from .shapes import get_shapes_dataloader, get_shapes_metadata, get_shapes_features from .obverter import ( get_obverter_dataloader, get_obverter_metadata, ...
StarcoderdataPython
33774
import os import numpy as np import urllib from absl import flags import tensorflow as tf import tensorflow_probability as tfp tfb = tfp.bijectors tfd = tfp.distributions flags.DEFINE_float( "learning_rate", default=0.001, help="Initial learning rate.") flags.DEFINE_integer( "epochs", default=100, help="Numb...
StarcoderdataPython
1776466
# 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 use ...
StarcoderdataPython
1738854
<gh_stars>0 #!/usr/bin/env python3 import re import os import sys import time import subprocess import RPi.GPIO as GPIO import multiprocessing as mp from collections import defaultdict from configparser import ConfigParser GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(17, GPIO.OUT) GPIO.output(17, GPIO.HIG...
StarcoderdataPython
3257399
#!/usr/bin/python import requests import json class DataPuller(object): def __init__(): lunoBidPrice = 0 lunoAskPrice = 0 lunoBidUSD = 0 lunoAskUSD = 0 zarusd = 0 coinbaseBidPrice = 0 coinbaseAskPrice = 0 lunoFees = 0 coinbaseFees = 0 ...
StarcoderdataPython
3280834
<reponame>CharlesJ-ABu/MindMap<gh_stars>0 from header import * class Link: width = 3.0 length=0.0 z_length=0.0 def __init__(self, parentSheet, tA, tB, importance): self.root=parentSheet.root self.canvas=parentSheet.canvas self.parentSheet = parentSheet self.cs = self.parentSheet.cs self.tA = tA ...
StarcoderdataPython
1667397
from typing import NamedTuple class TVShow(NamedTuple): name: str class Episode(NamedTuple): tvshow: TVShow season: int number: int
StarcoderdataPython
30751
import os import sys import shutil import asyncio import aioboto3 from glob import glob from PIL import Image from fnmatch import fnmatch from src.secrets import ( SPACES_REGION, SPACES_BUCKET, SPACES_PREFIX, SPACES_ENDPOINT_URL, SPACES_ACCESS_KEY, SPACES_SECRET_KEY ) from src.format import (...
StarcoderdataPython
3387815
<reponame>steinarvk/numera-te-ipsum class OperationFailed(Exception): pass class ValidationFailed(Exception): pass
StarcoderdataPython
1689873
<filename>projects/Password_generator/password_generator.py<gh_stars>1000+ from tkinter import* from random import choice import string class App: def __init__(self): self.window = Tk() self.window.title('password_generator') self.window.iconbitmap('logo.ico') self.window.i...
StarcoderdataPython
1675431
from django.conf.urls.defaults import patterns, include, url from website.views import HomeView urlpatterns = patterns('', url(r'^home',HomeView.as_view(),name="home"), )
StarcoderdataPython
1753764
<filename>group/views.py<gh_stars>1-10 from django.shortcuts import render, redirect from django.http import HttpResponse, Http404, HttpResponseBadRequest from django.views.defaults import bad_request from django.urls import reverse from urllib.parse import urlencode import datetime import requests from utils import ...
StarcoderdataPython
127930
<reponame>zurfyx/udlchan<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-03-06 17:51 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] ...
StarcoderdataPython
1628689
<gh_stars>0 import os from smpl.package import SourcePackage from smpl.config_file import ConfigObject, PackageParms import smpl.util as util import smpl.log_module as logger import smpl.exec as exec # # llhttp is a project in which some of thec source code is generated. # to make it run # make release # th...
StarcoderdataPython
1614172
# -*- coding: utf-8 -*- from pathlib import Path from ..base import Property from ..serialise import YAML from .base import DetectionReader, GroundTruthReader, SensorDataReader class YAMLReader(DetectionReader, GroundTruthReader, SensorDataReader): """YAML Detection Writer""" path = Property(Path, doc="File ...
StarcoderdataPython
3338254
#!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: xag @license: Apache Licence @contact: <EMAIL> @site: http://www.xingag.top @software: PyCharm @file: StringUtils.py @time: 2020-04-11 18:39 @description:TODO """ import re def get_ava_string(str): """ 去掉特殊符号,保留正常内容 :param ...
StarcoderdataPython
3283470
<filename>analysis/make.py ################### ### ENVIRONMENT ### ################### import os import sys ### LOAD GSLAB MAKE ROOT = '..' gslm_path = os.path.join(ROOT, 'lib', 'gslab_make') sys.path.append(gslm_path) import gslab_make as gs ### PULL PATHS FROM CONFIG PATHS = { 'root': ROOT, 'config': os.pa...
StarcoderdataPython
1622473
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('auth', '0006_require_contenttypes_0002'),...
StarcoderdataPython
4836008
<filename>capstone_proj/reports_app/views.py<gh_stars>0 # Create your views here. from __future__ import absolute_import import json import requests from intuitlib.client import AuthClient from intuitlib.migration import migrate from intuitlib.enums import Scopes from intuitlib.exceptions import AuthClientError from ...
StarcoderdataPython
3347982
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'galvo.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtGui,...
StarcoderdataPython
3308631
import pytest import hls4ml import numpy as np from pathlib import Path from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Embedding test_root_path = Path(__file__).parent @pytest.fixture(scope='module') def data(): X = np.random.randint(10, size=(32, 100)) return X @pytest....
StarcoderdataPython
3285483
<gh_stars>0 from sklearn.metrics import classification_report, confusion_matrix, accuracy_score from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.naive_bayes import GaussianNB, MultinomialNB, ComplementNB, BernoulliNB, CategoricalNB from sklearn import svm...
StarcoderdataPython
102796
import logging from pathlib import Path def get_logger(logger_name: str): Path("logs/").mkdir(parents=True, exist_ok=True) logger = logging.getLogger(logger_name) logger.setLevel(logging.DEBUG) fh = logging.FileHandler('logs/' + logger_name + '.log') fh.setLevel(logging.DEBUG) ch = logging.Str...
StarcoderdataPython
103352
from srs_sqlite import load_srs if __name__ == '__main__': # load_srs('user/PathoKnowledge.db', debug=True) load_srs('user/PathoImages.db', debug=True)
StarcoderdataPython
71174
<filename>render/__init__.py<gh_stars>0 # # This source file is part of appleseed. # Visit https://appleseedhq.net/ for additional information and resources. # # This software is released under the MIT license. # # Copyright (c) 2014-2018 The appleseedhq Organization # # Permission is hereby granted, free of charge, to...
StarcoderdataPython
3267364
import numpy as np # Create some training samples. # Note the bias 1s added to the start of each raw sample. # By addign this, we allow the weight that corresponds # to this column in w to play the same role that the # variable b plays in our single dimension linear # regression function. X = np.array([ [1, 17.930...
StarcoderdataPython
138867
from setuptools import find_packages from setuptools import setup try: README = open("README.md").read() except IOError: README = None setup( name="pgjobs", version="0.2.1", description="Postgresql job scheduling", long_description=README, long_description_content_type="text/markdown", ...
StarcoderdataPython
111077
<reponame>smartao/estudos_python<gh_stars>0 #!/usr/bin/python3 ''' Interpolarção É substituir valores dentro da string ''' # Criando duas variaveis from string import Template nome, idade = '<NAME>', 30.98761 # Método mais antigo, menos recomendado! # # %s = sequencia de caracteres que sera interpretado pelo python ...
StarcoderdataPython
3334423
<reponame>neshdev/competitive-prog n = int(input()) arr = [int(x) for x in input().split()] hi_count = 0 lo_count = 0 hi = arr[0] lo = arr[0] for i in range(1,n): if arr[i] > hi: hi = arr[i] hi_count += 1 if arr[i] < lo: lo = arr[i] lo_count += 1 print(hi_count + lo_co...
StarcoderdataPython
3341093
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.mixins import LoginRequiredMixin from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.views import View from base.handlers.extra_handlers import ExtraHandler from jekyllnow.handle...
StarcoderdataPython
3227861
<filename>Filter/ICADL.py<gh_stars>1-10 import time from SPARQLWrapper import SPARQLWrapper, JSON from SPARQLWrapper.SPARQLExceptions import EndPointNotFound from stop_words import get_stop_words, StopWordError import regex #Change the rapidfuzz for fuzzywuzzy if it is needed the original implementation from rapidfuzz...
StarcoderdataPython
4811162
<gh_stars>1-10 import requests import uwsgi """ uwsgi --module "microWsgi.websockets:application" --http :5050 --stats stats.socket curl -i -N \ -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Host: 127.0.0.1:5050" \ -H "Origin: 127.0.0.1:5050" \ 127.0.0.1:5051 """ def application...
StarcoderdataPython
3241070
<gh_stars>0 def func(a, b, c, d): exact = (a*b*c*d) ra = round(a) #round sometimes gives us weird things rb = round(b) rc = round(c) rd = round(d) rounded = (ra*rb*rc*rd) difference = exact - rounded print(difference)
StarcoderdataPython
1606735
from setuptools import setup setup(name='mymessage', version='0.1', description='Helper for analyzing iMessage data', url='http://github.com/storborg/funniest', author='<NAME>', author_email='<EMAIL>', license='/', packages=['mymessage'], zip_safe=False)
StarcoderdataPython
128834
<gh_stars>10-100 #!/usr/bin/python # # -*- coding: utf-8 -*- # Copyright 2019 SAP SE or an SAP affiliate company. All rights reserved # ============================================================================ from collections import defaultdict from xai.data.exceptions import ItemDataTypeNotSupported from xai.da...
StarcoderdataPython
6109
<reponame>Ali-Tahir/sentry from __future__ import absolute_import import six import string import warnings import pytz from collections import OrderedDict from dateutil.parser import parse as parse_date from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy a...
StarcoderdataPython
1665707
from kratos import Interface, Generator, always_ff, posedge, verilog import tempfile import os class ConfigInterface(Interface): def __init__(self): Interface.__init__(self, "Config") width = 8 # local variables read = self.var("read_data", width) write = self.var("write_da...
StarcoderdataPython
74910
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Test that the fuzzer works the way ClusterFuzz invokes it.""" import glob import os import shutil import sys import tempfile import unittest import setu...
StarcoderdataPython
3332254
# encoding: utf-8 import pytest from web.dispatch.route.router import __DYNAMIC__, Router from sample import Root @pytest.fixture def router(): return Router.from_object(Root) def test_dynamic_repr(): assert repr(__DYNAMIC__) == '<dynamic element>' def test_router_singleton(): assert Router.from_object(Root...
StarcoderdataPython
91774
<filename>mozillians/users/cron.py from django.conf import settings import cronjobs from celery.task.sets import TaskSet from celeryutils import chunked from elasticutils.contrib.django import get_es from mozillians.users.tasks import index_objects from mozillians.users.models import UserProfile, UserProfileMappingT...
StarcoderdataPython
4804774
import argparse import math import re import hashlib def hash_to_rgb(val): return [ tuple(ord(c)/255. for c in i.decode('hex')) for i in re.findall('.{6}', val) ] def string_to_rgb(val): return hash_to_rgb(hashlib.sha1(val).hexdigest()) def hash_keys(val): return [ (string_...
StarcoderdataPython
3208187
<gh_stars>10-100 from arcplus import *
StarcoderdataPython
1781211
<gh_stars>1-10 #!/bin/python """ grammar: S -> datasets eof datasets -> dataset datasets datasets -> epsilon dataset -> ( ident ) content content -> [ q ] content -> { data } q -> q , q q -> content data-> assignment data data-> epsilon assignment -> ident = value, value -> string value -> ident v...
StarcoderdataPython
30384
<reponame>carlosdaniel-cyber/my-python-exercises from time import sleep n1 = int(input('Primeiro valor: ')) n2 = int(input('Segundo valor: ')) op = 0 while op != 5: print(''' [ 1 ] somar [ 2 ] multiplicar [ 3 ] maior [ 4 ] novos números [ 5 ] sair do programa''') op = int(input('>>>>> Qual é ...
StarcoderdataPython
1640858
<filename>Leetcode/1000-2000/1016. Binary String With Substrings Representing 1 To N/1016.py<gh_stars>0 class Solution: def queryString(self, S: str, N: int) -> bool: if N > 1511: return False for i in range(N, N // 2, -1): if format(i, 'b') not in S: return False return True
StarcoderdataPython
123182
<filename>ARC/arc001-arc050/arc023/b.py # -*- coding: utf-8 -*- def main(): r, c, d = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(r)] ans = 0 # See: # https://www.slideshare.net/chokudai/arc023 for y in range(r): for x in range(c): ...
StarcoderdataPython
174311
<gh_stars>1-10 import os.path import torch import torch.nn as nn import torchvision import my_config import mnist device = my_config.device mnist_dir = exp.main_dir # data sets n_workers = 8 batch_size = 128 trainset = torchvision.datasets.MNIST( root=mnist_dir, train=True, download=True, transform=mnist.transfo...
StarcoderdataPython
1696055
<reponame>djpetti/isl-gazecapture<filename>itracker/common/network/autoencoder.py import tensorflow as tf from network import Network layers = tf.keras.layers K = tf.keras.backend class Autoencoder(Network): """ Implements autoencoder for analysing variations in eye or face appearance. """ def _build_custom...
StarcoderdataPython
3214484
<gh_stars>1-10 from .tool.func import * def api_search(name = 'Test', num = 10, page = 1): with get_db_connect() as conn: curs = conn.cursor() num = 1 if num > 1000 else num page = (page * (num - 1)) if page * num > 0 else 0 curs.execute(db_change('select data from other where nam...
StarcoderdataPython
1756333
import math def sonOrtogonales(x,y): cal = (x[0]*y[0]) + (x[1]*y[1]) if cal == 0: print("Son ortogonales") return True else: print("No son ortogonales") return False x = [1, 1.1024074512658109] y = [-1, 1/x[1]] if not sonOrtogonales(x,y): print("Algo salió mal") ...
StarcoderdataPython
117514
<gh_stars>1-10 import os from hotsos.core.host_helpers import ( APTPackageChecksBase, ServiceChecksBase, ) from hotsos.core import ( host_helpers, plugintools, ) from hotsos.core.config import HotSOSConfig SVC_VALID_SUFFIX = r'[0-9a-zA-Z-_]*' MYSQL_SVC_EXPRS = [r'mysql{}'.format(SVC_VALID_SUFFIX)] COR...
StarcoderdataPython
104859
<filename>nox/_parametrize.py<gh_stars>1-10 # Copyright 2017 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
StarcoderdataPython
9872
# Copyright 2018 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...
StarcoderdataPython
1688727
<reponame>NPAPENBURG/databases_ds33<filename>module1/buddymove_holidayiq.py """ Module to Query a database""" import sqlite3 import pandas as pd def connect_to_db(db_name='buddymove_holidayiq.sqlite3'): ''' Function to connect to the Database''' return sqlite3.connect(db_name) def execute_q(connection, quer...
StarcoderdataPython
70782
<reponame>sorasful/minos-python import unittest from minos.common import ( classname, ) from minos.networks import ( BrokerCommandEnrouteDecorator, BrokerEventEnrouteDecorator, BrokerQueryEnrouteDecorator, EnrouteAnalyzer, PeriodicEventEnrouteDecorator, RestCommandEnrouteDecorator, Rest...
StarcoderdataPython
1746093
<filename>meta_policy_search/utils/rl2/__init__.py<gh_stars>1-10 from meta_policy_search.utils.rl2.serializable import Serializable from meta_policy_search.utils.rl2.utils import *
StarcoderdataPython
89072
from KingMaker.processor.tasks.CROWNBuild import CROWNBuild import law import luigi import os from subprocess import PIPE from law.util import interruptable_popen from processor.framework import RemoteTask class ProducerDataset(RemoteTask): """ collective task to trigger ntuple production of a given dataset...
StarcoderdataPython
1754515
<reponame>johnbanq/modl # Author: <NAME> # License: BSD import time import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt from modl.datasets.image import load_image from modl.decomposition.image import ImageDictFact, DictionaryScorer from modl.feature_extraction.image import LazyCleanPatchExtract...
StarcoderdataPython
40502
#! /usr/bin/env python import pandas as pd import click ''' gene expression matrix, with gene id in first column, gene expression level of each sample in othre columns. ''' @click.group(chain=True, invoke_without_command=True) @click.argument('exp_table', type=click.STRING, required=True) @click.pass_con...
StarcoderdataPython
1709095
<reponame>dscook/topic-classification-with-kbs #!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import requests from collections import defaultdict from sklearn.metrics import classification_report, confusion_matrix from sklearn.ensemble import RandomForestClassifier from kb_common import wiki_topics_...
StarcoderdataPython
1634087
#!/usr/bin/python import socket import struct import sys import zlib from google.protobuf import service import rpc_pb2 import rpcservice_pb2 def encode(message): body = "RPC0" + message.SerializeToString() cksum = zlib.adler32(body) return "".join((struct.pack(">l", len(body) + 4), body, struct.pack(">...
StarcoderdataPython
3301391
from .rpc_block_digestors import * from .rpc_dev_digestors import * from .rpc_log_digestors import * from .rpc_mining_digestors import * from .rpc_node_digestors import * from .rpc_state_digestors import * from .rpc_submission_digestors import * from .rpc_transaction_digestors import * from .rpc_whisper_digestors impor...
StarcoderdataPython
4801791
<filename>tests/functional/Hydro/Riemann/RiemannSolution.py #!/usr/bin/env python #------------------------------------------------------------------------------- # RiemannSolution # # Adapted from code I got from <NAME>, which in turn was based on code from # Toro as described in the following comments. # # Exact Riem...
StarcoderdataPython
1772112
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 28 18:28:37 2021 @author: shreyan """ import turtle import random wn = turtle.Screen() wn.title("Pong") wn.bgcolor("white") xres = 1024 yres = 720 wn.setup(width = xres, height = yres) wn.tracer(0) #padde 1 paddle1 = turtle.Turtle() paddle1.spee...
StarcoderdataPython
3234728
<reponame>calculusrobotics/RNNs-for-Bayesian-State-Estimation<filename>Blender 2.91/2.91/scripts/addons/object_collection_manager/operators.py # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as pub...
StarcoderdataPython