id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
4919109
<gh_stars>0 import torch import torch.nn.functional as F import torch.nn as nn class SiamusicLoss(nn.Module): def __init__(self,dim=1): super().__init__() self.dim = dim def neg_cos_sim(self,p,z): z = z.detach() p = F.normalize(p,dim=self.dim) # default : L2 norm z = F...
StarcoderdataPython
1683812
<filename>src/mask.py import math import numpy as np import torch from PIL import Image, ImageDraw def generate_random_mask(height: int = 256, width: int = 256, min_lines: int = 1, max_lines: int = 4, min_vertex: int =...
StarcoderdataPython
294941
import pytest from coalescenceml.artifacts import DataArtifact from coalescenceml.producers.exceptions import ProducerInterfaceError from coalescenceml.producers.base_producer import BaseProducer from coalescenceml.producers.producer_registry import register_producer_class class TestProducer(BaseProducer): __tes...
StarcoderdataPython
6664114
<gh_stars>0 from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager app = Flask(__name__) app.config['SECRET_KEY'] = '<KEY>' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db' db = SQLAlchemy(app) login_manager = LoginManager(app) from seriously_portfolio import ...
StarcoderdataPython
36936
import speedtest def perform_test(): s = speedtest.Speedtest() best_server = s.get_best_server() print('Best server: ') print(best_server['name']) print('Perform upload app:') result = s.upload() print('Done:' + str(result / 1024 / 1024) + ' MBit/s') print('Perform download app:') ...
StarcoderdataPython
5034817
<filename>metadeploy/api/migrations/0113_builtin_jsonfield.py # Generated by Django 3.1.12 on 2021-07-29 19:54 import django.core.serializers.json from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("api", "0112_merge_20201130_1757"), ] operations =...
StarcoderdataPython
9707937
<reponame>oseme-techguy/python-pdf-annotation-api-demo """Utilities """ from re import match from urllib import parse import datetime import calendar import time import json import requests import uuid from app.helpers.json_converter import JSONConverter class Utilities: """Utilities """ @staticmethod ...
StarcoderdataPython
3212601
# Packages import numpy as np from scipy.misc import imresize import keras.backend as K from keras import losses,metrics from keras.models import load_model def rmse(y_true,y_pred): '''Accepts true labels and predictions. Returns Root mean squared error''' return K.sqrt(K.mean(K.square(y_pred-y_true))) def lo...
StarcoderdataPython
4990720
<gh_stars>0 #! /usr/bin/env python3 """ Thermal decomposition in the n-,s-C5H11 system (two-well, two-channel, 1D ME as a function of E) Steady-state decomposition of equilibrated mixture of n- and s-C5H11 and eigenvalues sample output (c5h11_2b_me1d_E_eig.dat): T[K] p[bar] w1-k2(dis) w2-k2(dis) ktot[s...
StarcoderdataPython
3376571
from typing import TYPE_CHECKING if TYPE_CHECKING: from Platforms.Discord.main_discord import PhaazebotDiscord from Platforms.Web.main_web import PhaazebotWeb import discord import html from aiohttp.web import Response from Utils.Classes.extendedrequest import ExtendedRequest from Utils.Classes.htmlformatter import ...
StarcoderdataPython
3521721
<reponame>1029127253/Product-Title-Classification from __future__ import print_function, unicode_literals import pandas as pd from collections import Counter import re def process(our_data): our_data=our_data.lower() return list(our_data) def is_right(uchar): if uchar >= u'\u4e00' and uchar <= u'\u9fa5...
StarcoderdataPython
223128
import datetime import dateutil.parser from sqlalchemy import func import ckan.model as ckan_model import ckan.plugins.toolkit as tk import ckanext.requestdata.model as requestdata_model import ckanext.ytp.request.model as membership_model get_action = tk.get_action class MembershipRequestsDao(object): def __...
StarcoderdataPython
5110302
<filename>github-100-exercises/day9.py """ Define a function which can compute the sum of two numbers. def sum_num(a,b): print(f'{a} + {b} = {a+b}') if __name__ == '__main__': num1=int(input('please enter first number: ')) num2=int(input('please enter second number: ')) sum_num(num1,num2) """ "...
StarcoderdataPython
6447565
<filename>api/schedules/stats_farm.py # # Performs an hourly insert of latest stats for the farm summary # import datetime import sqlite3 import traceback from flask import g from common.config import globals from common.utils import converters from api import app from api.commands import chia_cli DATABASE = '/root...
StarcoderdataPython
9683817
<reponame>xloem/kivy-launcher<filename>main.py # -*- coding: utf-8 -*- def run_entrypoint(entrypoint): import runpy import sys import os entrypoint_path = os.path.dirname(entrypoint) sys.path.append(os.path.realpath(entrypoint_path)) runpy.run_path( entrypoint, run_name="__main...
StarcoderdataPython
9681500
<gh_stars>10-100 # 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 # dis...
StarcoderdataPython
1819230
<filename>grove/grove_gpio.py<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Grove Base Hat for the Raspberry Pi, used to connect grove sensors. # Copyright (C) 2018 Seeed Technology Co.,Ltd. ''' ''' import time from grove.gpio import GPIO __all__ = ["GroveGpio"] class ...
StarcoderdataPython
1858582
# -*- coding: UTF-8 -*- import logging from typing import List from echoscope.config import config from echoscope.util import str_util, log_util, clickhouse_util from echoscope.model import ds_model, config_model from echoscope.source import source class ClickhouseSource(source.Source): def __init__(self): s...
StarcoderdataPython
3353748
#python 3 compatibility from __future__ import print_function from .gridbase import Grid from .dataset import DataSetException from .grid2d import Grid2D import abc from collections import OrderedDict class MultiGrid(Grid): def __init__(self,layers,descriptions=None): """ Construct a semi-abstrac...
StarcoderdataPython
1897567
#!/usr/bin/env python3 import argparse import asyncio from aiohttp import ClientSession, BasicAuth, ClientTimeout import os import sys import logging import aiohttp_github_helpers as h GITHUB_USER = os.environ['GITHUB_USER'] GITHUB_PASS = os.environ['GITHUB_PASS'] TIMEOUT = ClientTimeout(total=20) AUTH = BasicAuth(GI...
StarcoderdataPython
4947450
from time import sleep from json import dumps from confluent_kafka import avro from confluent_kafka.avro import AvroProducer # Define Amazon MSK Brokers brokers='<YOUR_MSK_BROKER_1>,<YOUR_MSK_BROKER_2>' # Define Schema Registry schema_registry='<YOUR_SCHEMA_REGISTRY>' # Define Kafka topic to be produced to kafka_topi...
StarcoderdataPython
5030557
<reponame>ryu57/pyHalo from pyHalo.Halos.halo_base import Halo import numpy as np class NFWFieldHalo(Halo): """ The main class for an NFW field halo profile without truncation See the base class in Halos/halo_base.py for the required routines for any instance of a Halo class """ def __init__(sel...
StarcoderdataPython
6573751
<filename>Game(Stone,paper,scissor).py<gh_stars>1-10 import random li=['stone','paper','scissor'] n=1 while(n==1): user1=random.choice(li) user2=input("Enter Your Choice: ") print("Computer Choice is: ",user1) print("Your choice is: ",user2) if(user1=='stone'): if(user2==scissor): ...
StarcoderdataPython
8171782
# -*- coding: utf-8 -*- from NLU.consult.dinning_nlu import dinning_nlu_rule from NLG.consult.dinning_nlg import nlg_confirm_conditions, nlg_recommend_restaurant, nlg_confirm_each_slot, dinning_reply def judge_confirm_each_slot(state_tracker_obj, last_slot_state, current_slot, yes_no): if last_slot_state in curr...
StarcoderdataPython
3360317
<reponame>markbeep/Lecturfier import aiohttp import discord from discord.ext import commands, tasks import random import asyncio import os from helper import image2queue as im2q from helper.sql import SQLFunctions from PIL import Image, ImageDraw, ImageFont import PIL import io from discord.ext.commands.cooldowns impor...
StarcoderdataPython
1711427
import datetime import logging from pathlib import Path import boto3 import requests from .metadata import Netkan, CkanGroup from .common import sqs_batch_entries class NetkanScheduler: def __init__(self, path, ckan_meta_path, queue, base='NetKAN/', nonhooks_group=False, webhooks_group=False): self.path...
StarcoderdataPython
11222596
from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy as np import os import six import random from PIL import Image from torch.utils import data import warnings import matplotlib.pyplot as plt import torch import pandas as pd # ---------...
StarcoderdataPython
3444461
# Generated by Django 2.2.10 on 2020-06-03 19:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('customer', '0007_auto_20200603_1337'), ] operations = [ migrations.AddField( model_name='profile', name='lat', ...
StarcoderdataPython
1807167
<filename>hooks/charmhelpers/contrib/openstack/ip.py # Copyright 2014-2015 Canonical Limited. # # This file is part of charm-helpers. # # charm-helpers is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foun...
StarcoderdataPython
12816414
<gh_stars>0 from django.core.management.base import BaseCommand, CommandError from accounts.models import Plan, ThumbSize class Command(BaseCommand): help = 'Create base plans and thumbnail resolutions' def handle(self, *args, **options): #foreign key here when file is original thumb_original ...
StarcoderdataPython
9703540
import discord from .utils.u_mongo import Mongo from discord.ext import commands from discord.ext.commands import has_permissions class Admin(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(pass_context=True) @has_permissions(administrator=True) async def set_...
StarcoderdataPython
9668527
w = 9 #Default Number representation base 10 decimal x = 0b1010 #Binary number base 2 y = 0o1247 #Octal Number base 8 z = 0xa43d #Hexadecimal number base 16 print(w); print(type(w)); print(x); print(type(x)); print(y); print(type(y)); print(z); print(type(z)); #decimal to hex conversion print(hex(w)); #decimal t...
StarcoderdataPython
5188971
<gh_stars>1-10 import pandas as pd from goatools.associations import read_gaf from goatools.base import dnld_gaf from goatools.base import download_go_basic_obo from goatools.obo_parser import GODag from tqdm import tqdm from linker.constants import * def download_ontologies(): """ Download ontologies, a dic...
StarcoderdataPython
105679
<filename>rnn.py import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = x_train.astype('float32') / 255 x_test = x_test.astype('float32') / 255 ...
StarcoderdataPython
8043704
""" The MIT License (MIT) Copyright (c) 2015-2021 Rapptz Copyright (c) 2021-present Disnake Development 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 limi...
StarcoderdataPython
3203977
"""Contract test package. Modules: test_ping """
StarcoderdataPython
11340590
# xpyBuild - eXtensible Python-based Build System # # This class is responsible for working out what tasks need to run, and for # scheduling them # # Copyright (c) 2013 - 2017 Software AG, Darmstadt, Germany and/or its licensors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use ...
StarcoderdataPython
8105834
<gh_stars>0 from typing import Callable from inspect import signature from enum import Enum import functools from .exceptions import InvalidParameters, NoPermissionError from .context import MessageContext class Mode(Enum): POSITIONAL = 0 NON_POSITIONAL = 1 OWNER_ONLY = 2 FREE = 3 class Parameter(En...
StarcoderdataPython
11307388
<filename>resources/dot_PyCharm/system/python_stubs/-762174762/PySide/QtGui/QGraphicsAnchor.py<gh_stars>1-10 # encoding: utf-8 # module PySide.QtGui # from C:\Python27\lib\site-packages\PySide\QtGui.pyd # by generator 1.147 # no doc # imports import PySide.QtCore as __PySide_QtCore import Shiboken as __Shiboken clas...
StarcoderdataPython
6699637
<reponame>Appnet1337/OSINT-SAN from settings import gmap_api, ipstack_api import requests import gmplot # from plugins.api import ipstack import webbrowser import re # from plugins.api import gmap from ipaddress import * from plugins.webosint.who.whois import * if not ipstack_api: print("Добавьте ключ api ipstac...
StarcoderdataPython
9773188
<reponame>kevinconway/venvctrl """Test suites for virtual environment features.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import os import subprocess import uuid import pytest from venvctrl import api @py...
StarcoderdataPython
9705194
from abc import ABC import numpy as np from gym import spaces import copy from .environment import Environment class Gridworldpy(object): def __init__(self, size=5): self.size = int(size) self.x = int(0) self.y = int(0) self.count = 0 nums = self.size **2 self.nums...
StarcoderdataPython
230780
#!/usr/bin/env python import main import unittest class Tests(unittest.TestCase): def test_area_of_triangle(self): self.assertEqual(main.get_area_of_triangle(3, 4, 5), 6.0) def test_negative_number_rejected(self): self.assertRaises(main.InvalidTriangleException, mai...
StarcoderdataPython
8074339
<gh_stars>0 """ device_wrangler.py Instantiate devices and perform inital configuration """ # from typing import Dict from smbus2 import SMBus, i2c_msg class device_wrangler(object): def __init__(self, device_assignments): self.bus = SMBus(1) self.devices = {} print('Initializing...
StarcoderdataPython
6485988
import os import requests from flask_restful import Resource from flask_restful import reqparse class WeatherEndpoint(Resource): def get(self): parser = reqparse.RequestParser() # parser.add_argument('longitude', required=True , type=float, help='longitude is a required arguement') # pars...
StarcoderdataPython
9603761
<filename>qiita_pet/test/test_prep_template.py # ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # -...
StarcoderdataPython
1674648
"""Public interface for btlewrap.""" import sys # This check must be run first, so that it fails before loading the other modules. # Otherwise we do not get a clean error message. if sys.version_info <= (3, 4): raise ValueError('this library requires at least Python 3.4. ' + 'You\'re running v...
StarcoderdataPython
6574135
""" Wrapper around mypy which prevents the number of typecheck errors from increasing but which does not force you to fix them all. Developed against mypy 0.770 Verified to work with 0.790 """ import json import os import re import subprocess import sys from dataclasses import dataclass from typing import List, Option...
StarcoderdataPython
1825010
<gh_stars>0 def evaluate(s): su = 0 last_op = '+' i = 0 while i < len(s): if s[i] == '+': last_op = '+' elif s[i] == '*': last_op = '*' elif s[i] == ')': print("returning on )") return su,i elif s[i] == '(': pr...
StarcoderdataPython
11253174
<filename>app/api/images.py import asyncio from contextlib import suppress from sanic import Blueprint, response from sanic.log import logger from sanic_openapi import doc from .. import helpers, models, settings, utils blueprint = Blueprint("images", url_prefix="/images") @blueprint.get("/") @doc.summary("List sa...
StarcoderdataPython
5155407
<reponame>Knowledge-Precipitation-Tribe/Neural-network<filename>code/NonLinearBinaryClassification/XorGateClassifier-keras.py # -*- coding: utf-8 -*-# ''' # Name: XorGateClassifier-keras # Description: # Author: super # Date: 2020/5/25 ''' from XorGateClassifier import * from keras.models impo...
StarcoderdataPython
6430857
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: p = head all_val = [] while p: q = ListNode(0) ...
StarcoderdataPython
96429
# Str! API_TOKEN = 'YOUR TOKEN GOES HERE' # Int! ADMIN_ID = 'USER_ID OF PERSON(s) DESIGNATED AS ADMINS'
StarcoderdataPython
17043
from pprint import pprint from enum import Enum class Direction(Enum): UP = 'up' DOWN = 'down' LEFT = 'left' RIGHT = 'right' class Network: def __init__(self, diagramRows): self.diagram = self.setDiagram(diagramRows) self.currentPosition = self.setCurrentPosition() self.cur...
StarcoderdataPython
9631408
<gh_stars>0 def main(n): if n == 10: print "Blastoff!" elif n > 10: print "Number needs to be 10 or under." else: print n main(n + 1) main(1)
StarcoderdataPython
5048228
<gh_stars>1-10 """ Name : Check_2d_fft.py Author: <NAME> e-mail: <EMAIL> Date : 2021-07-14 DESC : """ from numpy import genfromtxt import numpy as np import matplotlib.pyplot as plt import fluidplasma as fp # Merge all small csv file into signel matrix for i in range(99, 899, 100): fname = "./data/FFT/PH"+str...
StarcoderdataPython
8145738
<filename>source/remediation_runbooks/scripts/MakeRDSSnapshotPrivate.py #!/usr/bin/python ############################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
StarcoderdataPython
3297925
from pymongo import MongoClient from sampledata import Sampledata import pymongo class Db: env = 'prod' client = MongoClient() # client = MongoClient("mongodb://mongodb0.example.net:55888") sampledata = Sampledata() def __init__(self): if self.env == 'prod': self.db = self.clie...
StarcoderdataPython
1969860
<reponame>keaparrot/secbootctl # secbootctl - Secure Boot Helper # # @license https://github.com/keaparrot/secbootctl/blob/master/LICENSE.md from __future__ import annotations from pathlib import Path class Env: APP_NAME: str = 'secbootctl' APP_VERSION: str = '0.2.0' APP_TITLE: str = f'{APP_NAME} v{APP_...
StarcoderdataPython
6513366
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Mon Feb 14, 2011 @author:<NAME> Random sample features to initialize k-mean. Each block is processed in a separate thread. """ import os; import dbrec3d_batch import multiprocessing import Queue import time import random import optparse import sys from numpy i...
StarcoderdataPython
97224
<reponame>mcara/stsci.skypac """skymatch""" import os from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not installed __version__ = 'UNKNOWN' # from .version import version as __version__ __auth...
StarcoderdataPython
1968084
<gh_stars>0 #!/usr/bin/env python """Read a list of AWS ECR images from stdin and return a list of hashes that are older than --num-to-keep in --branch.""" import json import sys from collections import OrderedDict from datetime import timedelta, datetime from optparse import OptionParser def sortdict(d): """Sort ...
StarcoderdataPython
3210483
<gh_stars>1-10 import matplotlib.pyplot as plt # position visualization def plot(new, ticker1, ticker2): """Visualise a position given a _signals_ object and two ticker names""" fig = plt.figure(figsize=(10, 5)) bx = fig.add_subplot(111) bx2 = bx.twinx() # plot two different assets (l1,) = bx...
StarcoderdataPython
3399524
<reponame>Pathfinder-for-Pitch-Momentum-Bias/FlightSoftware<gh_stars>1-10 import subprocess import pty import json import os import serial import unittest class TestDownlinkParser(unittest.TestCase): """ Ensures that the downlink parser accumulates downlink packets and dumps the data contained in a downlin...
StarcoderdataPython
4946905
<gh_stars>0 import os from pathlib import Path import pytest import toml tests_location = os.path.dirname(os.path.realpath(__file__)) @pytest.fixture( params=Path(os.path.join(tests_location, "texts")).glob("*.toml") ) def test_text(request): yield toml.load(request.param)
StarcoderdataPython
1765563
import gzip import os import shutil from pathlib import Path from tempfile import NamedTemporaryFile import pytest import skhep_testdata import pylhe TEST_FILE = skhep_testdata.data_path("pylhe-testfile-pr29.lhe") @pytest.fixture(scope="session") def testdata_gzip_file(): test_data = skhep_testdata.data_path("...
StarcoderdataPython
1662308
<filename>892SurfaceArea/Surface.py """ 在 N * N 的网格上,我们放置一些 1 * 1 * 1  的立方体。 每个值 v = grid[i][j] 表示 v 个正方体叠放在对应单元格 (i, j) 上。 请你返回最终形体的表面积。   示例 1: 输入:[[2]] 输出:10 示例 2: 输入:[[1,2],[3,4]] 输出:34 示例 3: 输入:[[1,0],[0,2]] 输出:16 示例 4: 输入:[[1,1,1],[1,0,1],[1,1,1]] 输出:32 示例 5: 输入:[[2,2,2],[2,1,2],[2,2,2]] 输出:46 来源:力扣(Lee...
StarcoderdataPython
110112
<gh_stars>0 from struct import Struct # little-endian 0xfeedface MH_MAGIC = b'\xce\xfa\xed\xfe' # little-endian 0xfeedfacf MH_MAGIC_64 = b'\xcf\xfa\xed\xfe' LC_CODE_SIGNATURE = 0x1d # def struct_factory(target, little_endian=True): # if little_endian: # base = LittleEndianStructure # else: # b...
StarcoderdataPython
3305754
from screen import * import pygame import apple head_direction = 'RIGHT' apple_coordinate = apple.apple_coord sprite = pygame.image.load('assets/matheus.nielsen_snake.png') # sets snake direction def set_direction(direction): global head_direction head_direction = direction # exports snake's direction def ...
StarcoderdataPython
92372
n = int(input()) nums = list(map(int, input().strip().split())) print(min(nums) * max(nums))
StarcoderdataPython
168298
#======================================================================================================== # TOPIC: PYTHON - Modules #======================================================================================================== # NOTES: * Any Python file is a module. # * Module is a file with Python ...
StarcoderdataPython
11376702
from __future__ import annotations import typing as t # single source of truth for package version, # see https://packaging.python.org/en/latest/single_source_version/ __version__ = "0.3.10-dev" VersionType = t.Union[t.Tuple[int, int, int], t.Tuple[int, int, int, str]] # parse to a tuple def parse_version(s: str)...
StarcoderdataPython
12805963
def main(): h,w = map(int,input().split()) maze = [] for _ in range(h): s = list(input()) maze.append(s) ans = 0 dx = [ 1, 0,-1, 0] dy = [ 0, 1, 0,-1] key = 0 for sx in range(h): for sy in range(w): if maze[sx][sy] == '#': continue...
StarcoderdataPython
11286405
<gh_stars>0 #!/usr/bin/env python from __future__ import print_function, absolute_import, division import logging from collections import defaultdict from errno import ENOENT from stat import S_IFDIR, S_IFLNK, S_IFREG from sys import argv, exit from time import time from fuse import FUSE, FuseOSError, Operations, Lo...
StarcoderdataPython
8040740
<reponame>pratikadarsh/Algorithms<gh_stars>100-1000 ''' * @file TernarySearchDiscrete.py * @author (original JAVA) <NAME>, <EMAIL> * (conversion to Python) <NAME>, <EMAIL> * @date 29 Jun 2020 * @version 0.1 * @brief An implementation of Ternary search * Ternary search is similar to binary search ex...
StarcoderdataPython
4891593
palabra=input("Ingrese una palabra: ") Index=len(palabra)-1 nuevapalabra="" while Index>=0: nuevapalabra=nuevapalabra+palabra[Index] Index=Index-1 if palabra == nuevapalabra: print ("SI ES PALINDROMO") else: print("NO ES PALINDROMO")
StarcoderdataPython
353157
#!/usr/bin/env python # # Runs R Group Converter for Library Creation # # ---------------------------------------------------------- # imports # --------- from rdkit import Chem import ruamel.yaml as yaml from file_handler import FileWriter, FileParser # Load datasources # ------------- def load_datasources(): ...
StarcoderdataPython
11208488
<reponame>neilom18/g5-chess<gh_stars>0 from time import time print(int(time()% 10000))
StarcoderdataPython
9786766
from nltk.translate.bleu_score import sentence_bleu as bleu from nltk.translate.bleu_score import SmoothingFunction class Bleu(object): def __init__(self, settings): self.settings = settings def eval(self, hypList, refList): number = len(hypList) n_ref = len(refList) / number ...
StarcoderdataPython
9783670
import copy import topside as top from topside.procedures.tests.testing_utils import NeverSatisfied def one_component_engine(): states = { 'open': { (1, 2, 'A1'): 1, (2, 1, 'A2'): 1 }, 'closed': { (1, 2, 'A1'): top.CLOSED, (2, 1, 'A2'): top....
StarcoderdataPython
3334822
# coding=utf-8 import os import re import datetime from django.conf import settings from dju_common.tools import dtstr_to_datetime from .image import adjust_image, image_get_format from .tools import get_profile_configs, get_variant_label, get_relative_path_from_img_id, media_path, save_file from . import settings as d...
StarcoderdataPython
6619137
import os import pandas as pd output_dir = os.path.join('/sb-personal/cvqa/', 'data/visual-genome/8-26-2017/generated-data/') questions_output_file = os.path.join(output_dir, 'actions_vg_expanded_dataset-v3.csv') new_questions_output_file = os.path.join(output_dir, 'specific_relevance_actions_vg_expanded_dataset-v2.cs...
StarcoderdataPython
4970178
from ._SetCameraInfo import *
StarcoderdataPython
299506
import theano.tensor try: # Statsmodels is optional from statsmodels.genmod.families.links import (identity, logit, inverse_power, log) except: identity, logit, inverse_power, log = [None] * 4 __all__ = ['Identity', 'Logit', 'Inverse', 'Log'] class LinkFunction(object): """Base class to define link f...
StarcoderdataPython
5199231
<reponame>redshodan/codepunks<filename>setup.py import os import runpy from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.md')).read() CHANGES = open(os.path.join(here, 'CHANGES.md')).read() tests_require = [ 'pytest', 'pyte...
StarcoderdataPython
11368755
<gh_stars>1-10 #!/usr/bin/env python # The MIT License (MIT) # # Copyright (c) 2013 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation...
StarcoderdataPython
176688
<reponame>DalavanCloud/owning-a-home-api<filename>ratechecker/tests/helpers.py<gh_stars>1-10 from cStringIO import StringIO from datetime import date from zipfile import ZipFile from ratechecker.dataset import Dataset def get_sample_cover_sheet(day=None): day = day or date.today() return ( '<data>' ...
StarcoderdataPython
4921201
#!/usr/bin/python # Copyright (c) 2013, <NAME>. # All rights reserved. # # Released under the BSD 2-Clause license as published at the link below. # http://opensource.org/licenses/BSD-2-Clause import datetime import functools import json import logging import re import socket import xmlrpclib import bottle import pkg_...
StarcoderdataPython
6498465
import re import textwrap import unicodedata import Default.comment import sublime import sublime_plugin def previous_line(view, sr): """sr should be a Region covering the entire hard line""" if sr.begin() == 0: return None else: return view.full_line(sr.begin() - 1) def next_line(view,...
StarcoderdataPython
5124507
import time import json import random import paho.mqtt.client as mqtt from threading import Timer from ruuvitag_sensor.ruuvi import RuuviTagSensor MQTTHOST = "mqtt.preview.oltd.de" MQTTPORT = 8883 client = mqtt.Client('rpi-gateway_%d' % (random.randint(0, 1024))) client.tls_set(ca_certs='chain.pem', certfile='devic...
StarcoderdataPython
224
# 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 # distributed under t...
StarcoderdataPython
8031330
<gh_stars>0 #!/usr/bin/env python3 # Copyright 2021 Unicorn # See LICENSE file for licensing details. # # Learn more at: https://juju.is/docs/sdk """Prometheus-bind-exporter as charm the service. """ import logging import subprocess from ops.charm import CharmBase from ops.framework import StoredState from ops.main ...
StarcoderdataPython
11338659
<filename>michelanglo_app/views/venus/venus_steps.py from __future__ import annotations from time import sleep from typing import List from michelanglo_protein import ProteinAnalyser, Mutation, ProteinCore, Structure, is_alphafold_taxon # noqa from michelanglo_transpiler import PyMolTranspiler # used solely for tem...
StarcoderdataPython
6470640
<gh_stars>0 __title__ = 'unpack_pixels' __author__ = '<NAME>' __license__ = 'MIT' __copyright__ = 'Copyright 2021, <NAME>'
StarcoderdataPython
162483
<filename>Curso Python/Mundo 1/Modulo3/Desafios/Desafio2/des022.py nome = str(input('Digite o seu nome completo: ')) nomelista = nome.split() print('O nome em maiúscula: {}'.format(nome.upper())) print('O nome em minúscula: {}'.format(nome.lower())) print('O total de letras são {} letras'.format(len(nome.replace(' ', '...
StarcoderdataPython
5065891
<filename>src/processing/cloudclipper.py import numpy as np from skimage.measure import points_in_poly class CloudClipper(): @staticmethod def factory(method, **kwargs): if method == "polar": return PolarClipper(**kwargs) elif method == "cartesian": return CartesianClipp...
StarcoderdataPython
3257873
<reponame>cfergeau/cluster-node-tuning-operator import fnmatch import re __all__ = ["DeviceMatcher"] class DeviceMatcher(object): """ Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of she...
StarcoderdataPython
208924
<reponame>kaferi/aspose-pdf-cloud-python # coding: utf-8 """ Aspose.PDF Cloud API Reference Copyright (c) 2021 Aspose.PDF Cloud 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 restri...
StarcoderdataPython
5168063
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Simple On Memory File System Creator """ import sys import argparse from pathlib import Path # table format: file:[next, pos, size, name] dir:[next, num, 0, name] def out_header(out, table, name): out.write('/* This file is generated by the MEMFS Converter */\...
StarcoderdataPython
3567573
import tkinter as tk import mysql.connector import tkinter.font as tf from tkinter import * def delete_user_account(): mydb = mysql.connector.connect( host="localhost", user="root", password="<PASSWORD>", database='project_dbms' ) mycursor = mydb.cursor() ...
StarcoderdataPython