hexsha
stringlengths 40
40
| size
int64 5
1.03M
| ext
stringclasses 9
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 3
241
| max_stars_repo_name
stringlengths 5
125
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
sequencelengths 1
10
| max_stars_count
int64 1
208k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
241
| max_issues_repo_name
stringlengths 5
125
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
sequencelengths 1
10
| max_issues_count
int64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
241
| max_forks_repo_name
stringlengths 5
125
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
sequencelengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 5
1.03M
| avg_line_length
float64 1.5
756k
| max_line_length
int64 4
869k
| alphanum_fraction
float64 0.01
0.98
| count_classes
int64 0
3.38k
| score_classes
float64 0
0.01
| count_generators
int64 0
832
| score_generators
float64 0
0
| count_decorators
int64 0
2.75k
| score_decorators
float64 0
0
| count_async_functions
int64 0
623
| score_async_functions
float64 0
0
| count_documentation
int64 3
581k
| score_documentation
float64 0.4
0.6
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
29c698fcf98da3c177cd1347dd70acef351370fb | 888 | py | Python | backend/src/feature_extraction/rolloff.py | AnXi-TieGuanYin-Tea/MusicGenreClassifiaction | a0b9f621b0a5d2451180b12af7681756c5abd138 | [
"MIT"
] | 7 | 2018-05-01T19:39:17.000Z | 2020-01-02T17:11:05.000Z | backend/src/feature_extraction/rolloff.py | AnXi-TieGuanYin-Tea/MusicGenreClassifiaction | a0b9f621b0a5d2451180b12af7681756c5abd138 | [
"MIT"
] | 10 | 2018-12-10T22:16:43.000Z | 2020-08-27T18:23:45.000Z | backend/src/feature_extraction/rolloff.py | AnXi-TieGuanYin-Tea/MusicGenreClassifiaction | a0b9f621b0a5d2451180b12af7681756c5abd138 | [
"MIT"
] | 2 | 2021-04-16T08:20:17.000Z | 2022-01-06T14:06:44.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 17 23:14:28 2018
@author: Akihiro Inui
"""
def rolloff(input_power_spectrum: list, param: float=0.85) -> float:
"""
Spectral Rolloff
:param input_power_spectrum: power spectrum in list
:param param: threadshold for roll off
:return Spectral Rolloff
"""
assert (param <= 0 or param >= 1) is False, "parameter must be between 0 and 1"
# Initialize energy and FFT number
energy = 0
count = 0
# Calculate total energy
total_energy = sum(input_power_spectrum[:]**2)
# Find Count which has energy below param*total_energy
while energy <= param*total_energy and count < len(input_power_spectrum):
energy = pow(input_power_spectrum[count], 2) + energy
count += 1
# Normalise Spectral Rolloff
return count/len(input_power_spectrum)
| 28.645161 | 83 | 0.667793 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 448 | 0.504505 |
29c8162014a517194fd9f41815841a6c8677d84e | 4,458 | py | Python | src/genie/libs/parser/iosxe/tests/ShowIpInterfaceBrief/cli/equal/golden_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 204 | 2018-06-27T00:55:27.000Z | 2022-03-06T21:12:18.000Z | src/genie/libs/parser/iosxe/tests/ShowIpInterfaceBrief/cli/equal/golden_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 468 | 2018-06-19T00:33:18.000Z | 2022-03-31T23:23:35.000Z | src/genie/libs/parser/iosxe/tests/ShowIpInterfaceBrief/cli/equal/golden_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 309 | 2019-01-16T20:21:07.000Z | 2022-03-30T12:56:41.000Z | expected_output = {
"interface": {
"GigabitEthernet0/0/0": {
"interface_is_ok": "YES",
"ip_address": "10.105.44.23",
"method": "other",
"protocol": "up",
"status": "up"
},
"GigabitEthernet0/0/1": {
"interface_is_ok": "YES",
"ip_address": "10.174.10.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"GigabitEthernet0/0/2": {
"interface_is_ok": "YES",
"ip_address": "10.64.10.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"GigabitEthernet0/0/3": {
"interface_is_ok": "YES",
"ip_address": "10.186.10.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"Loopback65528": {
"interface_is_ok": "YES",
"ip_address": "192.168.1.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"NVI0": {
"interface_is_ok": "YES",
"ip_address": "unassigned",
"method": "unset",
"protocol": "up",
"status": "up"
},
"Sdwan-system-intf": {
"interface_is_ok": "YES",
"ip_address": "192.168.10.64",
"method": "unset",
"protocol": "up",
"status": "up"
},
"TenGigabitEthernet0/0/4": {
"interface_is_ok": "YES",
"ip_address": "10.121.10.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"TenGigabitEthernet0/0/5": {
"interface_is_ok": "YES",
"ip_address": "unassigned",
"method": "unset",
"protocol": "down",
"status": "down"
},
"Tunnel1": {
"interface_is_ok": "YES",
"ip_address": "10.174.10.1",
"method": "TFTP",
"protocol": "up",
"status": "up"
},
"Tunnel2000000001": {
"interface_is_ok": "YES",
"ip_address": "192.168.2.1",
"method": "unset",
"protocol": "up",
"status": "up"
},
"Tunnel2000000002": {
"interface_is_ok": "YES",
"ip_address": "192.168.166.1",
"method": "unset",
"protocol": "up",
"status": "up"
},
"Tunnel3": {
"interface_is_ok": "YES",
"ip_address": "10.186.10.1",
"method": "TFTP",
"protocol": "up",
"status": "up"
},
"TwoGigabitEthernet0/1/0": {
"interface_is_ok": "YES",
"ip_address": "unassigned",
"method": "unset",
"protocol": "up",
"status": "up"
},
"TwoGigabitEthernet0/2/0": {
"interface_is_ok": "YES",
"ip_address": "unassigned",
"method": "unset",
"protocol": "up",
"status": "up"
},
"Ucse1/0/0": {
"interface_is_ok": "YES",
"ip_address": "10.19.14.1",
"method": "other",
"protocol": "down",
"status": "administratively down"
},
"Ucse1/0/1": {
"interface_is_ok": "YES",
"ip_address": "unassigned",
"method": "unset",
"protocol": "down",
"status": "administratively down"
},
"VirtualPortGroup0": {
"interface_is_ok": "YES",
"ip_address": "192.0.2.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"VirtualPortGroup1": {
"interface_is_ok": "YES",
"ip_address": "192.168.2.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"VirtualPortGroup3": {
"interface_is_ok": "YES",
"ip_address": "192.168.3.1",
"method": "other",
"protocol": "up",
"status": "up"
},
"VirtualPortGroup4": {
"interface_is_ok": "YES",
"ip_address": "192.168.166.1",
"method": "other",
"protocol": "up",
"status": "up"
}
}
}
| 29.328947 | 45 | 0.394796 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,281 | 0.511664 |
29d8926e28c855d35087d877a48866f5e57129f6 | 25 | py | Python | env/lib/python2.7/site-packages/grpc/_grpcio_metadata.py | husky-parul/SheHacks | 19383029947f50ebaf07232c9b2ee76c75d8ada6 | [
"Apache-2.0"
] | 2 | 2018-02-01T06:30:24.000Z | 2018-04-12T15:39:56.000Z | env/lib/python2.7/site-packages/grpc/_grpcio_metadata.py | husky-parul/SheHacks | 19383029947f50ebaf07232c9b2ee76c75d8ada6 | [
"Apache-2.0"
] | null | null | null | env/lib/python2.7/site-packages/grpc/_grpcio_metadata.py | husky-parul/SheHacks | 19383029947f50ebaf07232c9b2ee76c75d8ada6 | [
"Apache-2.0"
] | null | null | null | __version__ = """1.8.4""" | 25 | 25 | 0.56 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 0.44 |
29d92f0ff0b006c6d957ac126ab63d45f2f46f8c | 146 | py | Python | danesfield/core/admin/__init__.py | girder/Danesfield | 04b0e991cae52bda758de4ee3f7e04dab45f3ff9 | [
"Apache-2.0"
] | null | null | null | danesfield/core/admin/__init__.py | girder/Danesfield | 04b0e991cae52bda758de4ee3f7e04dab45f3ff9 | [
"Apache-2.0"
] | 24 | 2021-10-29T21:03:34.000Z | 2022-03-18T02:07:57.000Z | danesfield/core/admin/__init__.py | girder/Danesfield | 04b0e991cae52bda758de4ee3f7e04dab45f3ff9 | [
"Apache-2.0"
] | 1 | 2022-01-26T09:31:48.000Z | 2022-01-26T09:31:48.000Z | from django.contrib import admin
# general admin settings
admin.site.site_header = 'Danesfield Admin'
admin.site.site_title = 'Danesfield Admin'
| 24.333333 | 43 | 0.80137 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 60 | 0.410959 |
29e4187ad7c1dcf2ceaec9e4c64c93ba30148a08 | 88 | py | Python | twitoff/__init__.py | boscolio/twitoff-ds19 | 46449f9a55619a74dafa32ebee733daca8d1602f | [
"MIT"
] | null | null | null | twitoff/__init__.py | boscolio/twitoff-ds19 | 46449f9a55619a74dafa32ebee733daca8d1602f | [
"MIT"
] | null | null | null | twitoff/__init__.py | boscolio/twitoff-ds19 | 46449f9a55619a74dafa32ebee733daca8d1602f | [
"MIT"
] | null | null | null | from .app import create_app
# creates the app by calling the package
APP = create_app() | 22 | 40 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 40 | 0.454545 |
29e53d00d3dfdf9edbf744f3dfa7a95332d492b5 | 170 | py | Python | books/init_api.py | nabekabebe/BookFInder | aaa7eb3028cb2ef5552f865107ddb13a5dc3fde7 | [
"MIT"
] | null | null | null | books/init_api.py | nabekabebe/BookFInder | aaa7eb3028cb2ef5552f865107ddb13a5dc3fde7 | [
"MIT"
] | null | null | null | books/init_api.py | nabekabebe/BookFInder | aaa7eb3028cb2ef5552f865107ddb13a5dc3fde7 | [
"MIT"
] | null | null | null | from flask_restplus import Api
API = Api(
title="Book API",
version='1.0',
description="This Api provides endpoint for accessing books and their reviews."
)
| 21.25 | 83 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 82 | 0.482353 |
29ea1aef1c82bd772907c42e68df319791525947 | 6,824 | py | Python | Render2018/lib/create_config_bodyflow.py | BigOto2/BlenderRenderDNS | a8ff239ecffef5217f0db35d579227a0a444c32d | [
"MIT"
] | 1 | 2021-07-28T00:42:39.000Z | 2021-07-28T00:42:39.000Z | Render2018/lib/create_config_bodyflow.py | BigOto2/BlenderRenderDNS | a8ff239ecffef5217f0db35d579227a0a444c32d | [
"MIT"
] | null | null | null | Render2018/lib/create_config_bodyflow.py | BigOto2/BlenderRenderDNS | a8ff239ecffef5217f0db35d579227a0a444c32d | [
"MIT"
] | 1 | 2019-05-13T17:38:05.000Z | 2019-05-13T17:38:05.000Z | import os.path
import configparser
from dircheck import get_yesno_input
import create_jobscripts
from create_dirname_config import config_dirname_cfg
from create_all_dirs import create_all
import socket
import cgns_load_data
# Script that creates the two configuration files (case and render files) necessary to run the scripts, with a data file from Abhiram's body flow simulation as input.
# Check whether scripts being run on Mox
if socket.gethostname()[0:3] == "mox":
mox = True
blender_dir = "/gscratch/ferrante/blender/blender-2.78c-linux-glibc219-x86_64/./"
else:
mox = False
blender_dir = ""
# Check if dirname.cfg, which contains directory paths used throughout the scripts, exists - otherwise, create it
if not os.path.exists("dirname.cfg"):
config_dirname_cfg()
# Load important directories
dirname_config = configparser.ConfigParser()
dirname_config.read("dirname.cfg")
# Get case name. This corresponds to a specific .h5dns file and is specified by the user. A case config file will be created with its name.
case_name = input("Enter case name. This can be any string that refers to a particular VIZ.cgns file. ")
create_all(case_name)
case_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + case_name + "-case.cfg"
# If existing case config file exists, the user is specifying a particular .h5dns file that is already associated with
# this case name, so move on to render settings config. Otherwise, create case config file from user input.
if os.path.exists(case_config_path):
print("Found existing case configuration: " + case_config_path)
existing_case_config = configparser.ConfigParser()
existing_case_config.read(case_config_path)
print("data file: " + existing_case_config["STRING"]["h5dns_path"])
else:
# Create new case config file
new_case_config = configparser.ConfigParser()
# There are different sections for each datatype (this is how the scripts know what data types to load, when they are all saved as strings)
new_case_config["STRING"] = {}
new_case_config["FLOAT"] = {}
new_case_config["INT"] = {}
# Save important strings
new_case_config["STRING"]["case_name"] = case_name
new_case_config["STRING"]["data_file_type"] = "bodyflow"
h5dns_path = input("Enter absolute path to data file: ")
new_case_config["STRING"]["h5dns_path"] = h5dns_path
# Load data file and save important params
params = cgns_load_data.get_important_data(h5dns_path)
new_case_config["INT"]["tres"] = str(params["tres"])
new_case_config["INT"]["ires"] = str(params["ires"])
new_case_config["INT"]["jres"] = str(params["jres"])
new_case_config["INT"]["kres"] = str(params["kres"])
# Write case config file
with open(case_config_path, "w") as case_config_file:
new_case_config.write(case_config_file)
# Get render-specific config settings from user. This specifies what type of render to perform (photorealistic, surface
# temperature, ...), and other render settings (scale of droplet to render, etc.)
render_type = int(input("Select type of render to perform (enter number).\n 1 Streamline render\n 2 Vortex line render\n"))
render_name = input("Enter render profile name. This can be any string that refers to specific rendering settings for a data case. ")
# Initialize categories based on data types
new_render_config = configparser.ConfigParser()
new_render_config["STRING"] = {}
new_render_config["INT"] = {}
new_render_config["FLOAT"] = {}
new_render_config["BOOL"] = {}
new_render_config["STRING"]["render_name"] = render_name
# Determine settings from user that are specific to each type.
if (render_type == 1): # Streamline
# Name render config file based on the type of render being performed
render_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + render_name + "-render-streamline.cfg"
# Get some other settings
elif (render_type == 2): # Vortex line
render_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + render_name + "-render-vortexline.cfg"
# General inputs
new_render_config["INT"]["num_streamlines"] = input("Specify number of streamlines: ")
new_render_config["INT"]["streamline_seed"] = "777" #input("Specify random seed number to determine streamline start positions from: ")
new_render_config["FLOAT"]["view_fraction"] = input("Specify desired render frame width as multiple of domain length: ")
new_render_config["FLOAT"]["camera_azimuth_angle"] = input("Specify camera azimuth angle from the x-axis (deg): ")
new_render_config["FLOAT"]["camera_elevation_angle"] = input("Specify camera elevation angle from the horizontal (deg): ")
bg_image_enabled = get_yesno_input("Use custom background image? ")
if bg_image_enabled:
new_render_config["STRING"]["bg_image_filepath"] = dirname_config["DIRECTORIES"]["background_images"] + input("Specify background image name (in \"Render2018/BackgroundImages\"): ")
new_render_config["STRING"]["bg_color_1"] = ""
new_render_config["STRING"]["bg_color_2"] = ""
else:
new_render_config["STRING"]["bg_image_filepath"] = ""
new_render_config["STRING"]["bg_color_1"] = input("Specify R,G,B value of lower background color (separate floats by commas, values range from 0 to 1): ")
new_render_config["STRING"]["bg_color_2"] = input("Specify R,G,B value of upper background color (separate floats by commas, values range from 0 to 1): ")
new_render_config["FLOAT"]["resolution_percentage"] = input("Specify resolution percentage out of 100, as a percentage of 4K: ")
# Write render config file
with open(render_config_path, "w") as render_config_file:
new_render_config.write(render_config_file)
# Create slurm jobscript to run on Mox
slurm_name = case_name + "_" + render_name + ".slurm"
create_jobscripts.create_mox_slurm(slurm_dir=dirname_config["DIRECTORIES"]["RenderJobscripts"], slurm_name=slurm_name, job_name=case_name+"_"+render_name, lib_dir=os.getcwd(), python_file_to_run="render_init.py", case_config_path=case_config_path, render_config_path=render_config_path)
local_py_name = case_name + "_" + render_name + ".py"
create_jobscripts.create_local_py(python_dir=dirname_config["DIRECTORIES"]["RenderJobscripts"], python_filename=local_py_name, lib_dir=dirname_config["DIRECTORIES"]["lib"], python_file_to_run="render_init.py", case_config_path=case_config_path, render_config_path=render_config_path)
# Run jobscript if user desires
if mox:
if get_yesno_input("Run " + slurm_name + " to launch this rendering job?"):
os.system("sbatch -p ferrante -A ferrante " + dirname_config["DIRECTORIES"]["RenderJobscripts"] + "/" + slurm_name)
else:
if get_yesno_input("Run " + local_py_name + " to launch this rendering job?"):
os.system("python3 " + dirname_config["DIRECTORIES"]["RenderJobscripts"] + local_py_name)
| 56.396694 | 286 | 0.75381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,682 | 0.539566 |
29f700b90ab2377c8ba15763c3022ce5834a7f4f | 4,445 | py | Python | python/fe3lmaker/s3-driver.py | flarebyte/wonderful-bazar | 810514cd7d73505b11d738f8b84d91842d18d074 | [
"MIT"
] | null | null | null | python/fe3lmaker/s3-driver.py | flarebyte/wonderful-bazar | 810514cd7d73505b11d738f8b84d91842d18d074 | [
"MIT"
] | null | null | null | python/fe3lmaker/s3-driver.py | flarebyte/wonderful-bazar | 810514cd7d73505b11d738f8b84d91842d18d074 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# This software code is made available "AS IS" without warranties of any
# kind. You may copy, display, modify and redistribute the software
# code either by itself or as incorporated into your code; provided that
# you do not remove any proprietary notices. Your use of this software
# code is at your own risk and you waive any claim against Amazon
# Digital Services, Inc. or its affiliates with respect to your use of
# this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its
# affiliates.
import S3
import time
import sys
AWS_ACCESS_KEY_ID = '<INSERT YOUR AWS ACCESS KEY ID HERE>'
AWS_SECRET_ACCESS_KEY = '<INSERT YOUR AWS SECRET ACCESS KEY HERE>'
# remove these next two lines when you've updated your credentials.
print "update s3-driver.py with your AWS credentials"
sys.exit();
# convert the bucket to lowercase for vanity domains
# the bucket name must be lowercase since DNS is case-insensitive
BUCKET_NAME = AWS_ACCESS_KEY_ID.lower() + '-test-bucket'
KEY_NAME = 'test-key'
conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
generator = S3.QueryStringAuthGenerator(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
# Check if the bucket exists. The high availability engineering of
# Amazon S3 is focused on get, put, list, and delete operations.
# Because bucket operations work against a centralized, global
# resource space, it is not appropriate to make bucket create or
# delete calls on the high availability code path of your application.
# It is better to create or delete buckets in a separate initialization
# or setup routine that you run less often.
if (conn.check_bucket_exists(BUCKET_NAME).status == 200):
print '----- bucket already exists! -----'
else:
print '----- creating bucket -----'
print conn.create_located_bucket(BUCKET_NAME, S3.Location.DEFAULT).message
# to create an EU bucket
#print conn.create_located_bucket(BUCKET_NAME, S3.Location.EU).message
print '----- bucket location -----'
print conn.get_bucket_location(BUCKET_NAME).location
print '----- listing bucket -----'
print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries)
print '----- putting object (with content type) -----'
print conn.put(
BUCKET_NAME,
KEY_NAME,
S3.S3Object('this is a test'),
{ 'Content-Type': 'text/plain' }).message
print '----- listing bucket -----'
print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries)
print '----- getting object -----'
print conn.get(BUCKET_NAME, KEY_NAME).object.data
print '----- query string auth example -----'
print "\nTry this url out in your browser (it will only be valid for 60 seconds).\n"
generator.set_expires_in(60);
url = generator.get(BUCKET_NAME, KEY_NAME)
print url
print '\npress enter> ',
sys.stdin.readline()
print "\nNow try just the url without the query string arguments. it should fail.\n"
print generator.make_bare_url(BUCKET_NAME, KEY_NAME)
print '\npress enter> ',
sys.stdin.readline()
print '----- putting object with metadata and public read acl -----'
print conn.put(
BUCKET_NAME,
KEY_NAME + '-public',
S3.S3Object('this is a publicly readable test'),
{ 'x-amz-acl': 'public-read' , 'Content-Type': 'text/plain' }
).message
print '----- anonymous read test ----'
print "\nYou should be able to try this in your browser\n"
public_key = KEY_NAME + '-public'
print generator.make_bare_url(BUCKET_NAME, public_key)
print "\npress enter> ",
sys.stdin.readline()
print "----- getting object's acl -----"
print conn.get_acl(BUCKET_NAME, KEY_NAME).object.data
print "\n----- path style url example -----";
print "Non-location-constrained buckets can also be specified as part of the url path. (This was the original url style supported by S3.)\n";
print "Try this url out in your browser (it will only be valid for 60 seconds).\n"
generator.calling_format = S3.CallingFormat.PATH
url = generator.get(BUCKET_NAME, KEY_NAME)
print url
print "\npress enter> ",
sys.stdin.readline()
print '----- deleting objects -----'
print conn.delete(BUCKET_NAME, KEY_NAME).message
print conn.delete(BUCKET_NAME, KEY_NAME + '-public').message
print '----- listing bucket -----'
print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries)
print '----- listing all my buckets -----'
print map(lambda x: x.name, conn.list_all_my_buckets().entries)
print '----- deleting bucket ------'
print conn.delete_bucket(BUCKET_NAME).message
| 37.352941 | 142 | 0.730259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,600 | 0.584927 |
4b1ec72cd59cc0bdeabf8053a9474d679e3c099c | 963 | py | Python | src/main/tools/dbpy/FotechUtils/dbUtils.py | inqwell/inq | 31ce4cd6b9b123b1ec4462905ccbcf7c00d6efc3 | [
"BSD-3-Clause"
] | 1 | 2016-09-25T16:41:57.000Z | 2016-09-25T16:41:57.000Z | src/main/tools/dbpy/FotechUtils/dbUtils.py | inqwell/inq | 31ce4cd6b9b123b1ec4462905ccbcf7c00d6efc3 | [
"BSD-3-Clause"
] | null | null | null | src/main/tools/dbpy/FotechUtils/dbUtils.py | inqwell/inq | 31ce4cd6b9b123b1ec4462905ccbcf7c00d6efc3 | [
"BSD-3-Clause"
] | 2 | 2016-09-25T16:48:49.000Z | 2020-05-26T20:00:33.000Z | #
# $Header: /home/inqwell/cvsroot/dev/scripts/python/FotechUtils/dbUtils.py,v 1.1 2009/05/22 22:16:32 sanderst Exp $
#
import KBC.fotech
from Util import db
from dbConfig import configurationProvider
def getConnection( confile, system, level, access = "read", site = None, user = None, pwdfile = None ):
"""
Partial replacement for the db.py mess in cbtech/python2.5. You should use /prod/fotech/bin/generateDatabaseXml.py
to generate an xml file containing your system/level config from the old db.py. Then replace any call to db.getConnection
with dbUtils.getConnection and you should get back the same object that you would have got in the old strategy.
"""
config = configurationProvider( confile, pwdfile )
vendor, server, user, password, schema, host, port = config.getConnectionDetails( system, level, access, site, user )
return db._getConnection( vendor.upper(), server, schema, user, password )
| 45.857143 | 129 | 0.726895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 507 | 0.52648 |