id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3255945
<filename>src/boogie/models/decorators.py<gh_stars>0 from functools import wraps from django.db.models import Manager from sidekick import lazy, placeholder as this def manager_only(method=None): """ Decorator that marks a method as a manager method, i.e., it can only be accessed by a manager created wit...
StarcoderdataPython
3250384
from discord import Member from .Permission import Permission __author__ = '<NAME> (nint8835)' # noinspection PyBroadException class Connect(Permission): def has_permission(self, member: Member) -> bool: try: return any([role.permissions.manage_server for role in member.roles]) excep...
StarcoderdataPython
1685228
# -*- coding: utf-8 -*- import pandas as pd import torch from sklearn.metrics import log_loss, roc_auc_score,f1_score,classification_report from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder, MinMaxScaler import sys import os import torch.nn as nn import numpy...
StarcoderdataPython
1627472
<gh_stars>0 import sys ''' infile = Homo_sapiens.GRCh37.75.gtf (ensembl GTF gene set file) outfile = Homo_sapiens.GRCh37.75.gtf.tss FILTER - keep only lines that are "protein_coding" "gene" MUTATE - make it so that interval is start-start - append old end to the end of the attributes field ''' infile = sys.argv[1]...
StarcoderdataPython
4814442
import discord from discord.ext import commands from discord.ext.commands import CommandNotFound from discord.utils import get import asyncio import random import time import os import requests import json import re def save(savemap, file): with open(file, "w") as f: json.dump(savemap, f) def...
StarcoderdataPython
3282701
<reponame>ShivamPR21/cloe from conans import CMake, ConanFile, tools class RpcLibConan(ConanFile): name = "rpclib" channel = "dev" version = "v2.2.1_c5" license = "MIT" author = "carla-simulator" url = "https://github.com/carla-simulator/rpclib" description = "RPClib patch for carla" t...
StarcoderdataPython
137417
""" Loaders for different formats provided by PubMed. """ __author__ = "<NAME>" __all__ = ['PXMLLoader', 'PXMLFetcher', 'PMCLoader', 'PMCFetcher'] import os import logging import urllib.parse import urllib.request import itertools as it from lxml import etree from ._load import DocIterator, text_node from ..doc....
StarcoderdataPython
98835
# -*- coding: utf-8 -*- # @Time : 2020/9/10 # @Author : <NAME> # @File : .py # @Role : from tornado.web import RequestHandler from kube_bench.main import kube_daily_scan from libs.base_handler import BaseHandler from sqlalchemy import or_ from libs.pagination import pagination_util from models.kube_bench ...
StarcoderdataPython
3243893
"""For getting colors based on grouping characteristics.""" __copyright__ = "Copyright (C) 2016-2018, <NAME>, <NAME>, All rights reserved." __author__ = "<NAME>" class GrouperColors(object): """Groups the user GO ids under other GO IDs acting as headers for the GO groups.""" # hdrcol = '#1f0954' # dark ind...
StarcoderdataPython
153299
from codecs import ignore_errors from .tools import abort import sys import docker import json import importlib.util from retrying import retry import traceback from threading import Thread import subprocess import shutil from datetime import datetime import inquirer import os import click from pathlib import Path from...
StarcoderdataPython
3215191
import pytest from petisco import Persistence from petisco.extra.sqlalchemy import SqliteConnection, SqliteDatabase from tests.modules.extra.sqlalchemy.mother.model_filename_mother import ( ModelFilenameMother, ) @pytest.mark.integration def test_should_create_persistence_with_sqlite_database(): filename = M...
StarcoderdataPython
3372646
<reponame>ogorodnikov/m1 # bind = os.getenv('WEB_BIND', '0.0.0.0:8000') # accesslog = '-' # access_log_format = "%(h)s %(l)s %(u)s %(t)s '%(r)s' %(s)s %(b)s '%(f)s' '%(a)s' in %(D)sµs" # workers = int(os.getenv('WEB_CONCURRENCY', multiprocessing.cpu_count() * 2)) # threads = int(os.getenv('PYTHON_MAX_THREADS', 1)) # ...
StarcoderdataPython
1722830
<filename>Chapter 15/02 Putting everything together - Implementing a CNN/program.py import tensorflow as tf import imageio from tensorflow import keras # Putting everything together – implementing a CNN img_raw = tf.io.read_file('example-image.png') img = tf.image.decode_image(img_raw) print('Image shape:', img.shap...
StarcoderdataPython
1794394
import numpy as np class Party: def __init__(self, party_index, public_vector, secret_value, k): self.party_index = party_index self.public_vector = public_vector self.secret_value = secret_value self.secret_coefficients = 1 - np.random.random_sample(k-1) self.re...
StarcoderdataPython
3286012
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. # external from mixbox import fields, entities # internal import stix from stix.common import InformationSource, Statement # bindings import stix.bindings.indicator as indicator_binding class _BaseTestMechanism(...
StarcoderdataPython
3213857
from django.conf import settings from django.contrib.contenttypes.models import ContentType from .models import Car from .test import TestCase class RateViewTest(TestCase): """ tests for the RateView """ def setUp(self): self.test_user = self.make_user(username="test_user") self.fore...
StarcoderdataPython
3234160
<filename>sample_models.py from keras import backend as K from keras.models import Model from keras.layers import (BatchNormalization, Conv1D, Dense, Input, TimeDistributed, Activation, Bidirectional, SimpleRNN, GRU, LSTM, MaxPooling1D) from keras import layers def simple_rnn_model(input_dim, output_dim=29): ...
StarcoderdataPython
3273095
<reponame>kevindurston21/YANOM-Note-O-Matic<filename>src/conversion_settings.py """ A class for provision of conversion settings for manual or specific pre configured sets of conversion settings Quick set Functions to set the conversion settings values to values for common or typical conversion jobs. """ import loggin...
StarcoderdataPython
3325965
#!/usr/bin/env python3 """ Tests the grand_trade_auto.web.frontend.templates.main_layout.jinja2 rendering / functionality. Per [pytest](https://docs.pytest.org/en/reorganize-docs/new-docs/user/naming_conventions.html), all tiles, classes, and methods will be prefaced with `test_/Test` to comply with auto-discovery (ot...
StarcoderdataPython
4819896
<filename>magi/agents/impala/agent_distributed_test.py #!/usr/bin/env python3 """Integration test for the distributed agent.""" from typing import Optional from absl.testing import absltest import acme from acme.testing import fakes import launchpad as lp import numpy as np from magi.agents.impala import agent_distr...
StarcoderdataPython
4801087
<gh_stars>0 from analysize import Analysize from time import ctime import os import re analysize = Analysize() fold_data = 'data/' fold_result = 'result/' re_log = 'mysql-slow-digest-(\d+\-\d+\-\d+)--\d+.log' fs = os.listdir(fold_data) for f in fs: list_re = re.findall(re_log, f) # print(list_re) if len(...
StarcoderdataPython
60185
import dash_core_components as dcc import dash_html_components as html from plotly import graph_objs as go def render(): return html.Div(children=[ html.H1(children='{{cookiecutter.project_slug}}'), html.Div(children='Dash: A web application framework for Python.'), dcc.Graph( ...
StarcoderdataPython
1603101
import pygame from ui_element import UiElement class UiPanel(UiElement): def __init__(self, x, y, w, h): UiElement.__init__(self, x, y, w, h) self.color = (255, 255, 255) def draw(self, screen): pygame.draw.rect(screen, self.color, pygame.Rect(self.x, self.y, self.w, self.h))
StarcoderdataPython
3277133
<filename>custom-tests/app.py import time invoke_counter = 0 def handler(event, context): global invoke_counter invoke_counter += 1 wait_time = event.get("wait", "0.1") print(f"Starting to sleep...") time.sleep(float(wait_time)) print(f"Ending sleep...") counter = event["counter"] if...
StarcoderdataPython
1792490
<reponame>ebewe/mangopay2-python-sdk from mangopaysdk.entities.transaction import Transaction class PayOut (Transaction): def __init__(self, id = None): self.DebitedWalletId = None # PayInPaymentType (BANK_WIRE, MERCHANT_EXPENSE, AMAZON_GIFTCARD) self.PaymentType = None # One of P...
StarcoderdataPython
1607075
<gh_stars>100-1000 import doctest import pytest from insights.parsers import slabinfo, SkipException from insights.parsers.slabinfo import SlabInfo from insights.tests import context_wrap PROC_SLABINFO = """ slabinfo - version: 2.1 # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tu...
StarcoderdataPython
108654
#TRATANDO VÁRIOS VALORES total = soma = numb = 0 numb = int(input('digite o numero [999 para parar]: ')) while numb != 999: total += 1 soma = numb + soma numb = int(input('digite o numero [999 para parar]: ')) print(f'voce digitou {total} numeros e a soma entre eles é {soma}')
StarcoderdataPython
3363847
# The MIT License (MIT) # # Copyright (c) 2020 ETH Zurich # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
StarcoderdataPython
147120
<gh_stars>1-10 # Authors: <NAME> # # License: BSD-3 import numpy as np import torch from braindecode.models import Deep4Net from braindecode.models import EEGNetv4, EEGNetv1 from braindecode.models import HybridNet from braindecode.models import ShallowFBCSPNet from braindecode.models import EEGResNet def test_sha...
StarcoderdataPython
3310626
''' Feature functions Each feature function should take a single argument, the data, and maybe some keywords, and return a tuple: (values (np.array), feature_names ([str])) N = len(data) # or data.shape[0] k = len(feature_names) # varies based on data values.shape = (N, k) ''' import re import itertool...
StarcoderdataPython
173959
<gh_stars>0 import argparse import logging def parse_arguments() -> argparse.Namespace: parser = argparse.ArgumentParser(description='GStreamer samples argument parser') parser.add_argument('-ip', metavar='ip', type=str, default='127.0.0.1', help='str, rtsp ip address') parser.add_argument('-port', metava...
StarcoderdataPython
33853
import datetime import typing from . import enums, tools class CatalogueAPIWrapper: """Methods for listing objects""" def __init__( self, username: str, password: str, language: enums.Language = enums.Language.GERMAN ): """Create a new Wrapper containing functions for listing different o...
StarcoderdataPython
1776117
from sys import argv from datetime import date from time import strftime class Padron(object): """ Process padron files and export one file with the format for sysadmin """ def __init__(self, *args) -> None: self.argv = args[0] today = date.today() t = today.strftime("%d-%m-%Y")...
StarcoderdataPython
3300954
<reponame>thimic/PyFlow #!/usr/bin/env python3 # -*- coding: utf-8 -*- from nodal import demo from unittest import TestCase class TestDemo(TestCase): def test_demo(self): self.assertIsNone(demo.demo())
StarcoderdataPython
4833629
<reponame>wy-ei/Text-CNN import os import logging import sys import torch import torch.nn as nn import torch.nn.functional as F logging.basicConfig(level = logging.INFO, format = "%(asctime)s - %(message)s") logger = logging.getLogger(__name__) def train(model, optimizer, train_dl, val_dl, device=None, ep...
StarcoderdataPython
3363224
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import os import json import uuid import pytest from copy import deepcopy from sqlalchemy import create_engine from apiclient.discovery ...
StarcoderdataPython
1719604
""" Main file with routines to run Listener """ import random import time from signal import SIGINT, signal from pony.orm.dbapiprovider import DatabaseError from ImHearing import audio, logger, post_recording, pre_recording, reader from ImHearing.database import models # Configurations Sections GLOBAL_CONFIG, globa...
StarcoderdataPython
105571
"""Models for secret pages application.""" from django.db import models from django.conf import settings from django.template.loader import get_template, TemplateDoesNotExist from django.core.exceptions import ValidationError TEMPLATE_EXTENSION = '.html' class SecretPage(models.Model): """Model for a secret pag...
StarcoderdataPython
1783399
<gh_stars>1-10 import os feature_type = ["Fireplaces", "Hardwood_Floors", "Kitchen_Islands", "Skylights", "ADE20K_tagged"] room_type = ["living_room", "kitchen", "bedroom", "bathroom"] # Iterate over images collected for each feature type tag_list = {} for feature in feature_type: for room in room_type: ...
StarcoderdataPython
8520
""" module logging""" # logging
StarcoderdataPython
21283
__author__ = '<NAME>' def greeting(msg): print("We would like to say: " + msg)
StarcoderdataPython
1796374
import sqlite3 class databaseManager: def __init__(self, database): self.database = database self.connection = sqlite3.connect(self.database) self.cursor = self.connection.cursor() def getTables(self): self.cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")...
StarcoderdataPython
20514
<reponame>rsewell97/open-starship<filename>rockets/rocket.py import time import multiprocessing as mp import numpy as np from scipy.spatial.transform import Rotation from world import Earth class Rocket(object): def __init__(self, planet=Earth()): self.planet = planet self.propellant_mass = 1e6...
StarcoderdataPython
131192
import pytest import ray from ray import serve from ray.serve.config import BackendConfig def test_batching(serve_instance): client = serve_instance class BatchingExample: def __init__(self): self.count = 0 @serve.accept_batch def __call__(self, requests): se...
StarcoderdataPython
4816948
<gh_stars>0 """ Production settings """ from cyndiloza.settings.base import * DEBUG = False TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ '.cyndiloza.com' ] MEDIA_ROOT = '/home/richardcornish/webapps/cyndiloza_assets/media/' MEDIA_URL = 'http://assets.cyndiloza.com/media/' STATIC_ROOT = '/home...
StarcoderdataPython
1663022
<gh_stars>0 import unittest import random from selection import selection_sort class SelectionSortTests(unittest.TestCase): def test_selection_sort(self): """ Tests the selection_sort(list) method """ data = [3, 1, 10, 9] results = selection_sort(data) self.assert...
StarcoderdataPython
179939
def pow_root_pandigit(val, n, k):
StarcoderdataPython
182365
<reponame>sheepcloner/en_dictionaries_parsers #!/usr/bin/env python2 # -*- coding: utf-8 -*- ''' Parse Samuel Fallows synonyms and antonyms dictionary located here: http://www.gutenberg.org/files/51155/51155-0.txt For simplicity, I manually grabbed the dictionary section and placed it in the file referenced in the code...
StarcoderdataPython
29716
<reponame>ruslanlvivsky/python-algorithm<filename>swexpert/d3/sw_2817_1.py<gh_stars>1-10 test_cases = int(input().strip()) def sum_sub_nums(idx, value): global result if value == K: result += 1 return if value > K or idx >= N: return sum_sub_nums(idx + 1, value) sum_sub_nu...
StarcoderdataPython
4829418
import requests from bs4 import BeautifulSoup from time import sleep import os, json, django from user.exception import ValidationException from codechef.scraper import contestScraper, problemScraper, divisionScraper def OffsetLoader(contest_type): requested_contests = [] for i in range(0, 60, ...
StarcoderdataPython
1688094
# -*- coding: utf-8 -*- """ Vistara Runner Runner to interact with the Vistara (http://www.vistarait.com/) REST API :codeauthor: <NAME> <<EMAIL>> To use this runner, the Vistara client_id and Vistara oauth2 client_key and client_secret must be set in the master config. For example ``/etc/salt/master.d/_vistara.conf...
StarcoderdataPython
1768407
<filename>venv/lib/python3.6/site-packages/ansible_collections/community/hashi_vault/tests/unit/plugins/plugin_utils/base/test_hashi_vault_plugin.py # -*- coding: utf-8 -*- # Copyright (c) 2021 <NAME> (@briantist) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __futur...
StarcoderdataPython
1784135
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2022/3/8 4:39 下午 # @File : push3.py # @author : Akaya # @Software: PyCharm # push3 : it runs ok import subprocess as sp import cv2 as cv rtmpUrl = "rtmp://10.10.14.120/stream/9999" camera_path = "rtmp://10.10.14.120/stream/2233" cap = cv.Vid...
StarcoderdataPython
3218066
<filename>integration_tests/src/main/python/generate_expr_test.py<gh_stars>0 # Copyright (c) 2020-2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www....
StarcoderdataPython
1693606
<filename>Compilation/AST/Evaluate.py from Parser.ShiftReduce import ShiftReduce def evaluate_reverse_parse(parser_lr1, operations, tokens): if not parser_lr1 or not operations or not tokens: return # Nada que eval!!!! right_parse = iter(parser_lr1) tokens = iter(tokens) stack = [] for op...
StarcoderdataPython
1676142
<reponame>jwfh/build.mk #!/usr/bin/env python3 import configparser import json import os import shutil import sys from functools import partial import re PROFILE_TRANSFORMATIONS = {} CREDENTIALS_FILE = os.path.expanduser("~/.aws/credentials") class Credentials: def __init__(self, file_name: str = CREDENTIALS_F...
StarcoderdataPython
4825204
<gh_stars>1-10 import os.path import torch from torchvision import transforms class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = ...
StarcoderdataPython
3326163
<gh_stars>0 from configuration import * t_1 -= t_1[0] #converts unix time stamps to seconds k_B = 1.38064852 * 10**(-23) #Boltzmann constant in J/K def N_Y_inf(phi): #longterm annealing amplitude return g_y * phi def tau_...
StarcoderdataPython
151582
<reponame>gaps-closure/capo<filename>partitioner/src/partitioner.py<gh_stars>1-10 #import networkx import argparse import os import re import json import policy_resolver import ir_reader import dot_reader import graph_helper topology = {} class AnnotationInfo(): class ALabel(): def __init__(self, l, s, e...
StarcoderdataPython
3377381
<filename>model.py import os os.environ["CUDA_VISIBLE_DEVICES"]="-1" import tensorflow as tf from keras.layers import Dense, Flatten, Lambda, Activation, MaxPooling2D from keras.layers.convolutional import Convolution2D from keras.models import Sequential from keras.optimizers import Adam import helper # tf.python.co...
StarcoderdataPython
170906
import json import os from django.conf import settings from django.utils.translation import get_language from django.utils.translation import to_locale _JSON_MESSAGES_FILE_CACHE = {} def locale_data_file(locale): path = getattr(settings, 'LOCALE_PATHS')[0] return os.path.join(path, locale, "LC_FRONTEND_MESS...
StarcoderdataPython
16819
<reponame>007gzs/django-cool # encoding: utf-8 import operator from functools import reduce from django.core.exceptions import FieldDoesNotExist from django.db.models import Q from django.db.models.constants import LOOKUP_SEP def split_camel_name(name, fall=False): """ 驼峰命名分割为单词 GenerateURLs => [Generat...
StarcoderdataPython
142092
<reponame>caldarolamartin/hyperion """ ==================== Hydraharp Instrument ==================== This is the instrument level of the correlator Hydraharp400 from Picoquant """ from hyperion import logging import yaml #for the configuration file import os #for playing with files in operation...
StarcoderdataPython
1699755
print('\n [Welcome to face mask violation detection and recognition system.]') print(''' +-----------------+Menu+----------------+ | 1. New User Entry | | 2. today's violators | | 3. Start Main Application | | 4. Close/Exit | +--------------------...
StarcoderdataPython
45788
<filename>debug/vis.py import matplotlib.pyplot as plt import seaborn as sns def attention_visualization(att): sns.heatmap(att[0, :, :]) plt.show()
StarcoderdataPython
184624
<reponame>deeplearningunb/NextValue<gh_stars>0 from App import App app = App() app.title("NextValue") app.geometry("1200x800") app.mainloop()
StarcoderdataPython
4800092
import asyncio import curses import time from time import sleep from pynput import keyboard from client.appstate import AppState from ._ui import UI from .widget.button import Button from .widget.progress_bar import ProgressBar from .widget.simple_textbox import Box class Host_game_scr(UI): """defines the ui s...
StarcoderdataPython
159041
import os from datetime import datetime from unittest.mock import patch import pytest from slackclient import SlackClient as RealSlackClient from sqlalchemy import create_engine from sqlalchemy.orm import Session import karmabot.commands.topchannels from karmabot.commands.joke import _get_closest_category from karmab...
StarcoderdataPython
55441
from collections import defaultdict from advent_of_code.core import parse_input, mapt test_input = """0,9 -> 5,9 8,0 -> 0,8 9,4 -> 3,4 2,2 -> 2,1 7,0 -> 7,4 6,4 -> 2,0 0,9 -> 2,9 3,4 -> 1,4 0,0 -> 8,8 5,5 -> 8,2""" def count(iterable, predicate=bool): return sum(1 for item in iterable if predicate(item)) def ...
StarcoderdataPython
146721
<reponame>aisamanra/camkes-tool # # Copyright 2017, Data61 # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # ABN 41 687 119 230. # # This software may be distributed and modified according to the terms of # the BSD 2-Clause license. Note that NO WARRANTY is provided. # See "LICENSE_BSD2.txt" for ...
StarcoderdataPython
1618016
<reponame>abb-iss/distributed-fuzzy-vault """ Poly Ring by user6655984 on StackOverflow https://stackoverflow.com/questions/48065360/interpolate-polynomial-over-a-finite-field """ import itertools class PolyRing: def __init__(self, field): self.K = field def add(self, p, q): s = [sel...
StarcoderdataPython
16258
<reponame>cads-build/VTK r""" Currently, this package is experimental and may change in the future. """ from __future__ import absolute_import #------------------------------------------------------------------------------ # this little trick is for static builds of VTK. In such builds, if # the user imports this Pyt...
StarcoderdataPython
4806209
import os from os.path import join def countlines(start): lines = 0 for thing in os.listdir(start): thing = os.path.join(start, thing) if os.path.isfile(thing): if thing.endswith('.py'): with open(thing, 'r') as f: newlines = f.readlines() ...
StarcoderdataPython
1606781
<reponame>Montana/Godec import json import sys import os import re from subprocess import call SkipConvstate = True PrintLabels = False if (len(sys.argv) != 2): sys.exit("Usage: Json2graph.py <json file>"); def depthToColor(level): if level == 0: return "#dddddd" if level == 1: return "#bbbbbb" retur...
StarcoderdataPython
1688916
# Copyright 2018 Google LLC. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # #...
StarcoderdataPython
3283996
""" Расчет зазоров между плоскостью и поверхностью заготовки """ import numpy as np from matplotlib.patches import Rectangle from mpl_toolkits.mplot3d.art3d import Line3DCollection from gap_finder.coordinate import Coordinate from gap_finder.generation import build_plane_by_three_coordinates from gap_finder.graphics i...
StarcoderdataPython
1726978
from HTMLTableToList import HTMLTableToList from pprint import pprint html_table_string = """<table class="table table-condensed"> <tr> <th>RGB</th> <td>53</td><td>72</td><td>35</td> </tr> <t...
StarcoderdataPython
1780498
<filename>src/zope/catalog/text.py ############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should acco...
StarcoderdataPython
36713
import matplotlib.pyplot as plt import numpy as np def count_harmonic_numbers(n: int): count = 0 for i in range(1, n+1): # 1 ~ N まで for _ in range(i, n+1, i): # N以下の i の倍数 count += 1 return count x = np.linspace(1, 10**5, 100, dtype='int') y = list(map(lambda x: count_harmonic_numb...
StarcoderdataPython
28160
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ some helper funcs """ import json import logging import os import site import subprocess import sys import tempfile import exifread from PIL import Image PACKAGE_NAME = "einguteswerkzeug" # --- configure logging log = logging.getLogger(__name__) log.setLevel(logging...
StarcoderdataPython
1782804
from split_settings.tools import optional, include include( 'base.py', 'assets.py', 'apps.py', 'cms.py', 'placeholders.py', 'plugins.py', 'ckeditor.py', '_{{ project_name }}_dev.py', 'security.py', optional('local.py'), scope=globals() )
StarcoderdataPython
4819763
<reponame>TanZng/patrones-combinados class Personaje(object): def __init__(self, ultimate, arma, armadura, experiencia): self.__ultimate = ultimate self.__arma = arma self.__armadura = armadura self.__experiencia = experiencia @property def ultimate(self): return se...
StarcoderdataPython
3209676
# pylint: disable=no-member,line-too-long from __future__ import print_function from builtins import str # pylint: disable=redefined-builtin import datetime import pytz from django.conf import settings from django.core import management from django.core.management.base import BaseCommand from ...decorators import...
StarcoderdataPython
1608732
<reponame>AI-Pranto/OpenMOC<filename>sample-input/sph-factors/slab/sph-factors.py import openmoc import openmc.mgxs import openmc.openmoc_compatible import numpy as np import matplotlib # Enable Matplotib to work for headless nodes matplotlib.use('Agg') import matplotlib.pyplot as plt plt.ioff() opts = openmoc.opti...
StarcoderdataPython
1744379
<reponame>lermana/nyc_dob_analysis import numpy as np import pandas as pd from functools import wraps from multiprocessing.pool import Pool from . import meta def pass_through_func(): return {} def get_all_dataset_stuff(dataset_name): funcs = meta.get_funcs_for_dataset(dataset_name, globals()) # we ca...
StarcoderdataPython
125699
# -*- coding: utf-8 -*- """ Pharmacopedia.Py v1.0 Pharmacy Counting Project <NAME> DESCRIPTION Analyzes and organizes medical pharmacy data. Using data from the Centers for Medicare & Medicaid Services, this script calculates: (1) total number of prescribers and (2) total prescriber expenditure for all listed drugs....
StarcoderdataPython
3259373
from .pyB12MPS import * from .version import __version__
StarcoderdataPython
8570
from notion.client import NotionClient from notion.settings import Settings class Context: def __init__(self): self.settings = Settings.from_file() self._client = None def get_client(self): if not self._client: self.settings.validate() self._client = NotionClie...
StarcoderdataPython
1647143
<reponame>Paigekins/orb import json import time import timeago as timesince from collections import namedtuple def get(file): """ Reads a json file. Params: (str) file: JSON file Returns: (obj): Python object """ try: with open(file, encoding='utf8') as...
StarcoderdataPython
53509
import json from justfunc.env import setup_env from justfunc.evaluator import evaluate from justfunc.reader import read class JustFunc: def __init__(self): self.env = setup_env() def run(self, src): return evaluate(read(src), self.env) def run_repl(self, prompt=">>> "): while li...
StarcoderdataPython
3367498
import datetime import io import pathlib import pickle import re import uuid import gym import numpy as np import tensorflow as tf import tensorflow.compat.v1 as tf1 import tensorflow_probability as tfp from tensorflow.keras.mixed_precision import experimental as prec from tensorflow_probability import distributions a...
StarcoderdataPython
111458
<filename>NetworkEmulator/scheduler.py<gh_stars>0 #!/usr/bin/python ''' This module contains th elogic for the scheduler The scheduler used is the APScheduler ''' import os import subprocess import time from datetime import datetime, timedelta from collections import OrderedDict from apscheduler.schedulers....
StarcoderdataPython
192729
<reponame>LesTR/ambari-19653<filename>AMBARI-19653/package/scripts/workaround.py<gh_stars>0 #!/usr/bin/env python from resource_management.libraries.script import Script from resource_management import * import json from ambari_commons import OSCheck class Ambari19653Workaround(Script): def install_packages(self...
StarcoderdataPython
123715
# day_3/classes.py """ Classes are a way to encapsulate code. It is a way of keeping functions and data that represent something together and is a core concept to understand for object oreinted programing. """ class Person: def __init__(self, name: str, age: int) -> None: """ Initializes the pers...
StarcoderdataPython
3340144
<reponame>shwetabhsharan/leetcode def two_sum(nums, target): for i in range(0, len(nums)): for j in range(i+1, len(nums)): print nums[i], nums[j] if target == nums[i] + nums[j]: return [i, j] # two_sum([2, 7, 11, 15], 9) def two_sum_dict(nums, target): data_dict...
StarcoderdataPython
3344495
from datetime import timedelta from unittest import mock import pytest from cumulusci.core.flowrunner import StepSpec from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.utils import timezone from ..models import Job, SiteProfile, Step, Version @pytest.mark.dj...
StarcoderdataPython
1756768
import asyncio from urllib.parse import parse_qs from isodate import parse_duration from seabird.plugin import Plugin from . import URLPlugin, URLMixin from ..utils import fetch_json YOUTUBE_URL = ( "https://www.googleapis.com/youtube/v3/videos?" "part=contentDetails%2Csnippet&id={}&" "fields=items(con...
StarcoderdataPython
1767381
<reponame>monotropauniflora/PartSeg<filename>package/PartSeg/common_gui/algorithms_description.py import collections import typing from abc import ABCMeta, abstractmethod from copy import deepcopy from enum import Enum from qtpy.QtCore import Signal from qtpy.QtGui import QHideEvent, QPainter, QPaintEvent from qtpy.Qt...
StarcoderdataPython
1614904
from doc_linking import ensemble_dist_ranker, ensemble_dist_ranker_weighted, \ compute_precision_at_n, compute_mrr, get_normalized_distance, get_mean_centered_distance import pickle import numpy as np from scipy.stats import rankdata from scipy.stats import spearmanr # Multilingual topic models trained using the MLTM...
StarcoderdataPython
198717
<gh_stars>0 import os,sys import numpy as np import cv2 import caffe from sklearn.metrics import confusion_matrix def printRow(fs,record): for n in range(len(record)): fs.write('%f'%record[n]) if n<len(record)-1: fs.write(',') fs.write('\n') def preprocess(input,mode): output=[...
StarcoderdataPython