id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
102042
#!/usr/bin/env python3 # SPDX-License-Identifier: BlueOak-1.0.0 import datetime as dt import mimetypes import subprocess import os import tempfile import urllib.parse import mimetypes from functools import partial from pathlib import Path, PurePosixPath import pygments import pygments.lexers import pygments.formatte...
StarcoderdataPython
3327970
<reponame>harigov/newsalyzer<gh_stars>1-10 import hashlib import math import os import sys import urlparse from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, jsonify, make_response import json from decorators import Monitor sys.path.insert(0,os.path.join(os.path.dirname(os...
StarcoderdataPython
1750024
<reponame>Octavian-ai/graph-node-categorizer<filename>graph_ml/dataset.py from collections import Counter, namedtuple import random import pickle import os.path import hashlib import neo4j import math from typing import Callable, Generator, Tuple import logging import itertools from itertools import cycle import more_...
StarcoderdataPython
1716358
media = 0 mulher = 0 maisvelho = '' iddvelho = 0 for c in range(1, 5): print('----- {}° PESSOA -----'.format(c)) nome = str(input('Digite seu nome: ')) idade = int(input('Digite sua idade: ')) sexo = str(input('Digite seu sexo: [M/F]: ').upper()) media += idade if c == 1 and sexo == 'M...
StarcoderdataPython
1738267
<reponame>mikkergimenez/p9-admin from __future__ import print_function from datetime import datetime import json import logging import p9admin.user MAPPING_NAME = "idp1_mapping" class SAML(object): # client should be p9admin.OpenStackClient def __init__(self, client, backup_directory="/tmp"): self.cli...
StarcoderdataPython
124236
class NoDataError(Exception): def __init__(self, field, obj, module): message = "Missing field '" + field + "' in the object " + str(obj) + " needed in " + module super(NoDataError, self).__init__(message)
StarcoderdataPython
1744438
import pytest from drig.networks import ResNet from drig.config import ImageCast, Stride from drig.networks import ResNet def test_residual_slab(batch_norm_tensor): filters = 64 residual_slab = ResNet.residual_slab( batch_norm_tensor, filters, channel_index=-1, clip=True, )...
StarcoderdataPython
4832484
<reponame>xrod/cosmic-ray-propagation<gh_stars>0 import os import sys sys.path.insert(1, "/afs/ifh.de/group/that/work-jh/git/numpy/") sys.path.insert(1, "/afs/ifh.de/group/that/work-jh/git/scipy/") import numpy as np import scipy as sc from silx.io.dictdump import dicttoh5 from silx.io.dictdump import h5todict import h...
StarcoderdataPython
3235897
<reponame>johncblacker/CircuitPython-GFX<gh_stars>1-10 class GFXfont: def __init__(self): self.GFXbitmaps = ( 0x18, 0xC6, 0x63, 0x18, 0xC4, 0x23, 0x18, 0x84, 0x00, 0x18, 0xC0, 0x33, 0x73, 0x66, 0x66, 0x66, 0x46, 0x06, 0x30, 0x61, 0x83, 0x18, 0x18, 0xC0, 0xC6, 0x7F, 0xFF, 0xFF, 0xE3, 0x18, 0x18, 0xC0, 0xC6, 0x0...
StarcoderdataPython
26563
<filename>discharge_plot.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Plots exceedance frequency and the relationships between discharge and drainage area for gauged basins Written by <NAME> for "Low variability runoff inhibits coupling of climate, tectonics, and topography in the Greater Caucasus" If you...
StarcoderdataPython
183117
<gh_stars>100-1000 """Extracts features and their descriptors from a single image. Authors: <NAME>, <NAME> """ from typing import Tuple from dask.delayed import Delayed from gtsfm.frontend.detector_descriptor.detector_descriptor_base import DetectorDescriptorBase class FeatureExtractor: """Wrapper for running ...
StarcoderdataPython
3364310
<reponame>EduardoMachadoCostaOliveira/Python # Faça um progama que leia o sexo de uma pessoa, mas só aceite os valores 'M' ou 'F'. # Caso esteja errado, peça a digitação novamente até ter um valor correto. # Minha solução '''sexo = 0 while sexo == 0: # print('Digite um valor valido para sexo!') sexo = str(inpu...
StarcoderdataPython
1735547
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-22 22:48 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ja_social', '0004_auto_20161022_2213'), ] operations = [ migrations.AddFiel...
StarcoderdataPython
3329950
# Faça um programa que leia 5 valores numéricos e guarde os em uma lista # no final mostre qual foi o maior e o menor valor digitado e as suas respectivas posições na lista valores = [] for c, v in enumerate(range(0, 5)): valores.append(int(input('Digite o valor na Posição {}: '.format(v)))) a = max(valores) ...
StarcoderdataPython
1613587
''' Module for device classes used either individually or in advanced forms. @authors: ogurreck, wilde ''' __version__ = '1.0' __date__ = '$Date: 2015 / 08 / 21' __all__ = [] from p05.devices.DeviceCommon import DeviceCommon from p05.devices.PMACcomm import PMACcomm __all__ += ['PMACcomm'] from p05.devices.PMACdict...
StarcoderdataPython
192642
from pwn import * from Crypto.Util.number import * from Crypto.Cipher import AES debug = True r = remote("crypto.chall.pwnoh.io", 13374, level = 'debug' if debug else None) r.recvuntil('p = ') p = int(r.recvline()) assert isPrime(p) g = 5 r.recvuntil('A = ') A = int(r.recvline()) B = pow(g, 57, p) ss = pow(A, 57, ...
StarcoderdataPython
1675973
from abc import ABC, abstractmethod import os import getpass import yaml import copy import numpy as np from .utils import (get_time, get_datetime, create_unique_folder, benchmark_matrix_inverse, benchmark_sha_hashing) from .procedures import Procedure from .functions import TestFunction, MLFunctio...
StarcoderdataPython
1871
<reponame>nicoddemus/aioworkers<filename>examples/web/handlers.py async def handler(context): return await context.data
StarcoderdataPython
3250588
from ambiLEDCollectionPoint import TVCollectionPoint as CollectionMethod
StarcoderdataPython
145345
<filename>esn_models.py ''' This file contains all the elements to define a reservoir, run it and collect states For training, you should create a reservoir, run it with the data, collect states and then use a linear readout to create the mapping. ''' import numpy as np import matplotlib.pyplot as plt import m...
StarcoderdataPython
3380478
<gh_stars>0 from abc import ABCMeta, abstractmethod from functools import wraps from copy import deepcopy from utensor_cgen.utils import parse_tensor_name class Transformer(object): """ Any subclass of Transformer should follow the signature of __new__ and __init__ defined here if the overwrite these two me...
StarcoderdataPython
3346296
<filename>ghostwriter/commandcenter/models.py """This contains all of the database models for the CommandCenter application.""" # Django Imports from django.db import models # Ghostwriter Libraries from ghostwriter.singleton.models import SingletonModel def sanitize(sensitive_thing): """ Sanitize the provid...
StarcoderdataPython
3318386
from functools import partial from ..utils.value_registry import ValueRegistry from .implicit_surface_loss import implicit_surface_loss from .loss_functions import euclidean_dual_loss from .coverage import cluster_coverage_with_reconstruction from .implicit_surface_loss_with_partition import implicit_surface_loss_wit...
StarcoderdataPython
59200
<reponame>bashmak/djing<filename>clientsideapp/apps.py<gh_stars>10-100 from django.apps import AppConfig class ClientsideappConfig(AppConfig): name = 'clientsideapp' verbose_name = 'Client side application'
StarcoderdataPython
1777898
from celery import chord, group from tasks import * chord( group(function_value.s(0, value=i) for i in range(1000)), function_any.s(from_chord=True) )()
StarcoderdataPython
3293365
# 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 # distribu...
StarcoderdataPython
19669
# -*- coding: utf-8 -*- import time, random def isort(i_list): for i in range(1, len(i_list)): for j in range(i,0, -1): if i_list[j] < i_list[j-1]: i_list[j], i_list[j-1] = i_list[j-1], i_list[j] else: break if __name__ == "__main__": alist = [] ...
StarcoderdataPython
1702931
from rubygems_utils import RubyGemsTestUtils class RubyGemsTestrubygems_aws_sdk_route53(RubyGemsTestUtils): def test_gem_list_rubygems_aws_sdk_route53(self): self.gem_is_installed("aws-sdk-route53") def test_load_aws_sdk_route53(self): self.gem_is_loadable("aws-sdk-route53")
StarcoderdataPython
1690004
# N 堆香蕉,第 i 堆有 piles[i] 根香蕉,假设吃香蕉速度为 K根/小时,求 H 小时内吃完所有香蕉的最小速度。 # 每个小时选择一堆,吃掉 K 根,如果这堆香蕉少于 K 根,就吃掉所有香蕉并不再多吃。 """ Input: piles = [3,6,7,11], H = 8 Output: 4 Input: piles = [30, 11, 23, 4, 20], H = 5 Output: 30 """ def brute_force(piles: list, hour: int): max_num = max(piles) for i in range(1, max_num+1): ...
StarcoderdataPython
3285191
__version__ = "0.1.2" from .github_activity import get_activity, generate_activity_md
StarcoderdataPython
3298942
import matplotlib.pyplot as plt import numpy as np def plot_image(image, shape=[256, 256], cmap="Greys_r"): plt.imshow(image.reshape(shape), cmap=cmap, interpolation="nearest") plt.axis("off") plt.show() def movingaverage(values,window): weights = np.repeat(1.0,window)/window smas = np.convolve(values,...
StarcoderdataPython
4836091
<reponame>kmarcini/Project-Euler-Python<filename>problem0226.py ########################### # # #226 A Scoop of Blancmange - Project Euler # https://projecteuler.net/problem=226 # # Code by <NAME> # ###########################
StarcoderdataPython
3241600
<reponame>fushihara/python-arib<gh_stars>10-100 #!/usr/bin/env python ''' Module: test Desc: Test to see how quickly I can parse TS es packets Author: <NAME> Email: <EMAIL> DATE: Thursday, October 20th 2016 ''' import os import sys import argparse import traceback from read import EOFError from mpeg.ts import TS from...
StarcoderdataPython
176317
import json from pymongo import MongoClient # Load 'config.json' file conf = json.load( open("config.json", "r+") ) # MongoDB Init client = MongoClient(conf["mongodb"]["connection-string"]) db = client.MyEshop promos = db.PromoCodes # Create 'Promo' class # It's main usecase is to make it easier # to work wi...
StarcoderdataPython
51200
<reponame>mmlado/animal_pairing from .models import Animal from rest_framework import viewsets from .serializers import AnimalSerializer class AnimalView(viewsets.ModelViewSet): queryset = Animal.objects.all() serializer_class = AnimalSerializer
StarcoderdataPython
3371108
# -*- coding: utf-8 -*- # # Copyright (C) 2019-2020 CERN. # # invenio-app-ils is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Configuration for Invenio ILS ILL module.""" from invenio_indexer.api import RecordIndexer from invenio_...
StarcoderdataPython
86710
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QAction from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal from OCC.Core.AIS import AIS_ColoredShape from OCC.Core.gp import gp_Ax3 from cadquery import Vector from ..mixins import ComponentMixin from ..icons import icon class CQChildItem(QTreeWidge...
StarcoderdataPython
1722383
# -*- coding: utf-8 -*- # Copyright 2020 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
StarcoderdataPython
1700730
# Copyright (c) Microsoft Corporation # Licensed under the MIT License. from unittest.mock import patch import pytest from raiwidgets import FairnessDashboard from raiwidgets.fairness_metric_calculation import \ MODULE_NOT_INSTALLED_ERROR_MESSAGE @patch("importlib.import_module") def test_no_fairlearn(importli...
StarcoderdataPython
66889
<filename>scripts/run_command.py """Entry point for main developer script. Usage: python scripts/run_command.py -h """ import argparse import json import logging import os import subprocess import sys import textwrap import init_path from pyelect.html import generator as htmlgen from pyelect import jsongen from pye...
StarcoderdataPython
3259881
from dataclasses import dataclass from typing import Optional from skynet.types.blockchain_format.sized_bytes import bytes32 from skynet.util.ints import uint64 from skynet.util.streamable import Streamable, streamable @dataclass(frozen=True) @streamable class LineageProof(Streamable): parent_name: bytes32 i...
StarcoderdataPython
1704690
<filename>selector/urls.py # -*- encoding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2015 <NAME>, http://haltu.fi # # 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 restrict...
StarcoderdataPython
177267
from .images import Images, COLOUR_MODES from .video import Video from .sequential import Sequential __all__ = ["Images", "COLOUR_MODES", "Video", "Sequential"]
StarcoderdataPython
3376005
import os import math import pandas as pd from sddip import config def main(): # TODO Select parameters for data generation test_case = "case30" t = 6 n = 12 scenario_str = f"t{str(t).zfill(2)}_n{str(n).zfill(2)}" # Ramp rate # (%/100 of rated capacity per unit time) ramp_rate = 0.1...
StarcoderdataPython
1670712
<filename>src/func.py<gh_stars>1-10 ## function define def trip(num): ## can't modify the value num *= 3 return num num = 8 print(trip(num)) print(num) ## 元音字母 def occur(word): word = word.upper() vowels = ('A', 'E', 'I', 'O', 'U') include = [] for vow in vowels: if (vow in word) and (vow not in include): ...
StarcoderdataPython
1702691
<filename>ichnaea/geocalc.py import math from country_bounding_boxes import country_subunits_by_iso_code from ichnaea import constants EARTH_RADIUS = 6371 # radius of earth in km _radius_cache = {} def maximum_country_radius(country_code): """ Return the maximum radius of a circle encompassing the larges...
StarcoderdataPython
3224325
<filename>data/yolo_dataset.py # -------------------------------------------------------- # Written by <NAME> at 3:34 PM 2/25/2021 # -------------------------------------------------------- import os import xml.etree.ElementTree as ET import numpy as np from .util import read_image class YoloDataset: def __in...
StarcoderdataPython
16986
#!/usr/bin/env python import rospy from std_msgs.msg import Float64 import random possibleLayers = [140, 50, 80, 200, 100] cur_position = 0.0 def position_callback(msg): global cur_position cur_position = msg.data #Build the layers simulation, then publish material strengths. Lasts 100 seconds. def runLayers...
StarcoderdataPython
1749527
from dev_db.creator import DevDBCreator from .models import Extra class ExampleDevDBCreator(DevDBCreator): def get_excluded_models(self): return super().get_excluded_models() + ["extra"] def add_extra_data(self, data): data.append(Extra.objects.first()) return data
StarcoderdataPython
3399194
#!/usr/bin/env python3 # coding: utf-8 import time import json from .level import Level from .types import * from .constants import * class Game: def __init__(self, level): self.level = level self.clock = sf.Clock() self.running = False self.pressed_keys = set() self.window = sf.RenderWindow( sf.Vide...
StarcoderdataPython
3362507
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import os import sys try: # pip 10+ from pip._internal.operations.freeze import freeze as pip_freeze except ImportError: from pip.operations.freeze import freeze as pip_freeze __version__ = '1.1.1' ...
StarcoderdataPython
76563
# Copyright 2010-2012 Opera Software ASA # # 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 ...
StarcoderdataPython
3248285
<reponame>kaland313/reinforceflow import numpy as np import tensorflow as tf def safe_normalize_tf(x: tf.Tensor): std = tf.math.reduce_std(x) if std > 0.: return (x - tf.math.reduce_mean(x)) / std else: # this most likely just returns zero return x - tf.math.reduce_mean(x) def ca...
StarcoderdataPython
44195
<gh_stars>1-10 import sys import time import random import commands import userinterface.Client as Client from taskbuffer.JobSpec import JobSpec from taskbuffer.FileSpec import FileSpec if len(sys.argv)>1: site = sys.argv[1] cloud = None else: site = None cloud = 'US' #cloud = 'TW' #Recent chang...
StarcoderdataPython
1720493
expected_output={'no-output': True}
StarcoderdataPython
17939
# _*_ coding:utf-8 _*_ import logging import re import app_config from bs4 import BeautifulSoup from shortcode import process_shortcode logging.basicConfig(format=app_config.LOG_FORMAT) logger = logging.getLogger(__name__) logger.setLevel(app_config.LOG_LEVEL) end_doc_regex = re.compile(ur'^\s*[Ee][Nn][Dd]\s*$', ...
StarcoderdataPython
131991
import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @no_debug_info_test def test(self): self.expect_expr("int i; __typeof__(i) j = 1; j", result_type="typeo...
StarcoderdataPython
78074
import doctest import sys from notebook import Notebook, Note class Menu: """ Menu class. Contains __init__ , display_menu, run, show_notes, search_notes, add_note, modify_note, quit methods """ def __init__(self): """ main method to create object. It is called when the n...
StarcoderdataPython
129350
<reponame>Waye/we-care """ A thin, practical wrapper around terminal capabilities in Python. http://pypi.python.org/pypi/blessed """ # std imports import platform as _platform if _platform.system() == 'Windows': from blessed.win_terminal import Terminal else: from blessed.terminal import Terminal if ('3', '0...
StarcoderdataPython
12348
import yaml import forest from forest import main def test_earth_networks_loader_given_pattern(): loader = forest.Loader.from_pattern("Label", "EarthNetworks*.txt", "earth_networks") assert isinstance(loader, forest.earth_networks.Loader) def test_build_loader_given_files(): """replicate main.py as clos...
StarcoderdataPython
1796810
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-05-22 18:09 # @Author : minp # @contact : <EMAIL> # @Site : # @File : test_read_html.py # @Software: PyCharm """ pandasSt.read_html(io, match='.+', flavor=None, header=None, index_col=None, skiprows=None, attrs=None, parse_dates=False, tupleize_co...
StarcoderdataPython
84428
<reponame>giacomov/fermi_blind_search<gh_stars>0 #!/usr/bin/env python # Distribute a set of points randomly across a sphere, allow them # to mutually repel and find equilibrium. import sys, os import string import random from math import pi, asin, atan2, cos, sin, sqrt import matplotlib.pyplot as plt plt.interactiv...
StarcoderdataPython
4839929
<filename>PyOszi.py #!/usr/bin/env python # Released under MIT license. # Based on code written by <NAME> <<EMAIL>>, released as public domain. from array import array import usb from time import sleep import queue import threading import sys from PIL import Image class PyOsziButtons: BTN_F0 ...
StarcoderdataPython
100162
import numpy as np from cumm import tensorview as tv from spconv.utils import Point2VoxelCPU3d from spconv.pytorch.utils import PointToVoxel, gather_features_by_pc_voxel_id import torch import numpy as np np.random.seed(50051) # voxel gen source code: spconv/csrc/sparse/pointops.py gen = PointToVoxel(vsize_xyz=[1, 1...
StarcoderdataPython
4807667
<gh_stars>0 from django.test import TestCase from django.urls import reverse class CourseDeleteViewTests(TestCase): fixtures = ['course', 'user'] def test_my_get_request(self): response = self.client.get(reverse('course-delete', args=(1,)), follow=True) self.assertContains(response, 'Are you ...
StarcoderdataPython
3243110
<reponame>code-iai/ConvertMeshToFBX #!/usr/bin/env python import os import bpy # loops over all subfolder CONVERT_DIR = "absolut/path/to/meshes/directory" def file_iter(path, ext): for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: extension = os.path.splitext(filen...
StarcoderdataPython
104704
## @defgroup Input_Output-FreeMind FreeMind # Function to save FreeMind output. # @ingroup Input_Output from .save import save
StarcoderdataPython
4838048
num=100 num=200
StarcoderdataPython
1703510
import os from zstacklib.utils import shell from zstacklib.utils import lvm from kvmagent.plugins.bmv2_gateway_agent import exception from kvmagent.plugins.bmv2_gateway_agent import utils as bm_utils from kvmagent.plugins.bmv2_gateway_agent.volume import base from kvmagent.plugins.bmv2_gateway_agent.volume import hel...
StarcoderdataPython
1605411
from collections import deque from haigha.classes import * from haigha.frames import * from haigha.exceptions import * class Channel(object): ''' Define a channel ''' class InvalidClass(ChannelError): '''The method frame referenced an invalid class. Non-fatal.''' class InvalidMethod(ChannelError): '''The ...
StarcoderdataPython
1697881
from .preprocessor import Preprocessor class Normalize(Preprocessor): """ Normiliza class for receive data and return normalized data No Attributes """ def normalize(self, tipo = 'sample'): if len(self.data) > 1: self.get_mean() self.get_stdev(tipo) ...
StarcoderdataPython
4817794
#!/usr/bin/python ## # @file # This file is part of SeisSol. # # @author <NAME> (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.) # # @section LICENSE # Copyright (c) 2013, SeisSol Group # All rights reserved. # # Redistribution and use in source and binary forms, with or with...
StarcoderdataPython
1701678
<gh_stars>1-10 import aiohttp class BadInput: def __init__(self, msg="Bad Input"): super().__init__(msg) class NonManner: def __init__(self): self.url = "https://userdb.ourmc.space/api/v1/report" async def search_by_name(self, username: str, skip=0, limit=100): return await self...
StarcoderdataPython
1763525
"""Tests for media.views.""" # pylint: disable=protected-access,maybe-no-member,invalid-name import json from django.conf import settings from django.core.urlresolvers import reverse from django.test import Client, TestCase, RequestFactory from django.test.utils import override_settings from mock import patch from op...
StarcoderdataPython
1769272
# importing pandas as pd import pandas as pd # diccionario de listas dict = {'nombre':["luis", "marcos", "marta", "pedro"], 'grado': ["LIC", "MTA", "DOC", "LIC"], 'puntaje':[90, 40, 80, 98]} # creando un marco de datos a partir de un diccionario df = pd.DataFrame(dict) for index, row in df.iter...
StarcoderdataPython
4816507
<reponame>AlbertoAdolfo27/webstore-python<gh_stars>0 # Generated by Django 3.2.9 on 2021-11-17 12:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0002_auto_20211117_0941'), ] operations = [ migrations.RenameModel( ...
StarcoderdataPython
1653924
<reponame>pyri-project/pyri-variable-storage<filename>src/pyri/variable_storage/__main__.py import sys import RobotRaconteur as RR RRN = RR.RobotRaconteurNode.s import RobotRaconteurCompanion as RRC from .storage import VariableStorageDB import argparse from RobotRaconteurCompanion.Util.InfoFileLoader import InfoFileLo...
StarcoderdataPython
183483
<reponame>train-your-deblender/cutout-evaluation from .blends import *
StarcoderdataPython
169577
from django.db import models from django.db.models.signals import pre_save from .utils import unique_slug_generator class Post(models.Model): title = models.CharField(max_length=150) body = models.TextField() date = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) ...
StarcoderdataPython
3272198
<gh_stars>1-10 # coding: utf-8 """ SasPhyData.py The Clear BSD License Copyright (c) – 2016, NetApp, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions...
StarcoderdataPython
1707747
<reponame>Fakhre-Alam-Hub/Attendance-System2 import os from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Attendance_System.settings') # application = get_wsgi_application() application = DjangoWhiteNoise(get_wsgi_applic...
StarcoderdataPython
3322538
<filename>Presentation/main.py from Logic.AutoChecker import * #import schedule import time #import os #os.system('curl','google.com') ac = AutoChecker("SECONDS", 3) ac.start()
StarcoderdataPython
97306
""" creates decorator for class that counts instances and allows to return and reset this value """ def instances_counter(cls): """Some code""" setattr(cls, 'ins_cnt', 0) def __init__(self): cls.ins_cnt += 1 cls.__init__ def get_created_instances(self=None): return cls.ins_cn...
StarcoderdataPython
1715157
<gh_stars>0 """ This script checks the tags for a given commit Checking if the tag matches the format sprint_X.Y Where X is the sprint number And Y is the revision number It will throw an error and fail the CI build if it does not match that format. """ import sys import re def exit(error_message...
StarcoderdataPython
1664146
<reponame>Sudani-Coder/python # Python Object Oriented Programming class Employee: def __init__(self, FirstName, LastName, salary): self.FirstName = FirstName self.LastName = LastName self.salary = salary self.email = FirstName + "." + LastName + "@<EMAIL>" def FullName(self):...
StarcoderdataPython
1607537
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from . import helper def print_version(): print( "OpenSim, Copyright (c) 2021 <NAME>, Version %s" % helper.get_version(), flush=True, ) def print_delimiter(): print( "---------------------...
StarcoderdataPython
153899
from setuptools import setup try: long_description = open("README.rst").read() except IOError: long_description = "" setup(name='DowPy', version='0.1.5', description='Module for downloading files over HTTP(s) efficiently', url='http://github.com/jhnbrunelle/dowpy', author='JohnBrunel...
StarcoderdataPython
3348904
<reponame>danchitnis/benchtop-demo-lidar import Tkinter as tk import ttk import tkMessageBox as messagebox import tkSimpleDialog as simpledialog import matplotlib matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk from matplotlib.figure import Figure from matp...
StarcoderdataPython
1787621
<filename>src/conan_app_launcher/settings/ini_file.py import configparser import os from pathlib import Path from typing import Any, Dict, Optional, Union from conan_app_launcher import PathLike from conan_app_launcher.app.logger import Logger from . import (APPLIST_ENABLED, DISPLAY_APP_CHANNELS, DISPLAY_APP_...
StarcoderdataPython
3233770
<gh_stars>1-10 import torch import numpy def close(a, b, rtol=1e-5, atol=1e-4): equal = torch.abs(a - b) <= atol + rtol * torch.abs(b) return equal ## differentiable newton iterations def inverse_bisection_n_newton(func, grad_func, target_arg, *args, min_boundary=-100000.0, max_boundary=100000.0, num_bisecti...
StarcoderdataPython
1760116
<filename>Pipeline/DDI/NER_DDI/src/GetCharDic.py<gh_stars>1-10 # -*- coding: utf-8 -*- import codecs as cs fp = cs.open('../data/DDI_train_BIOES.txt','r','utf-8') text = fp.read().split('\n\n')[:-1] fp.close() maxlen = 0 dic = {} index = 1 for sen in text: words = sen.split('\n') for w in words: token...
StarcoderdataPython
170840
<filename>src/NumberOfDiscIntersections.py<gh_stars>0 def solution(A): # write your code in Python 3.6 disks = [] for i,v in enumerate(A): disks.append((i-v,1)) disks.append((i+v,0)) disks.sort(key=lambda x: (x[0], not x[1])) active = 0 intersections = 0 for i,isBegin in disk...
StarcoderdataPython
3318922
<filename>python/build_chucknorris.py from cffi import FFI import json import path # add path definitions cpp_path = path.Path("../cpp").abspath() cpp_build_path = cpp_path.joinpath("build/default") ck_lib_path = cpp_build_path.joinpath("lib/chucknorris.lib") ck_include_path = cpp_path.joinpath("include") extra_object...
StarcoderdataPython
1796668
<filename>pyjrj/__init__.py from django.http import HttpResponse try: from threading import local except ImportError: from django.utils._threading_local import local _thread_locals = local() def require_login(next=None, internal=None): def decorator(view): def newview(request, *args, **kwargs): ...
StarcoderdataPython
1601818
<reponame>hullux/Questioner<filename>app/v1/users/__init__.py from flask import Blueprint simple_page = Blueprint('simple_page',__name__,url_prefix='/api/v1/') home_blueprint = Blueprint('home',__name__,url_prefix='/api/v1/') login_blueprint = Blueprint('login',__name__,url_prefix='/api/v1/') signup_blueprint = Bluepr...
StarcoderdataPython
19024
<reponame>liucong3/camelyon17 import numpy as np import torch.utils.data as data import csv import cv2 from PIL import Image from utils import progress_bar class CamelDataset(data.Dataset): """ camelyon17 dataset class for pytorch dataloader """ def __init__(self, csv_path='train.csv', limit=0, tran...
StarcoderdataPython
1724678
<gh_stars>1-10 # import available testers from xoa_driver import testers # import available modules type from xoa_driver import modules async def my_awesome_script(): tester = await testers.L23Tester("192.168.1.200", "JonDoe") # create tester instance and establish connection for module in tester.modules: ...
StarcoderdataPython
28979
<reponame>codered-by-ec-council/Micro-Degree-in-Python-Security #!/usr/bin/env python3 ''' This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any late...
StarcoderdataPython
3328896
<reponame>marcosptf/cpython-2.0.1<filename>Lib/test/test_copy_reg.py import copy_reg class C: pass try: copy_reg.pickle(C, None, None) except TypeError, e: print "Caught expected TypeError:" print e else: print "Failed to catch expected TypeError when registering a class type." print try: c...
StarcoderdataPython
1787003
''' Notification Application Views notification/views.py @author <NAME> (810Teams) ''' from rest_framework import permissions, viewsets, status from rest_framework.decorators import api_view from rest_framework.response import Response from smtplib import SMTPAuthenticationError from asset.models import A...
StarcoderdataPython